Skip to content

[gatsby-link] support passing state data in navigateTo #3728

@SanthoshRaju91

Description

@SanthoshRaju91

Description

Hi, wanted to know if it is possible to send data in programmatic navigation navigateTo() in gatsby link. Check the index.js file of gatsby-link, but seems there is not option to send in any data.

So that the rendering component gets it in the location.state object.

Environment

Gatsby version: 1.1.28
Node.js version: 8.9.4
Operating System: Mac OS

Expected behavior

Should be able to send data via navigateTo like

navigateTo('/pathname',  {
 id: 7,
 firstname: 'John Doe'
});

Please let me know the technicality of the index.js file of gatsby-link especially window.__navigateTo(), so I can help you with a PR, if you find this a appropriate question.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions