-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gatsby-link] support passing state data in navigateTo #3728
Comments
Currently Gatsby doesn't support passing history state. If you'd like to implement, please feel free to -- you'd need to pass along props eg here: |
Happy to help with this change. So I went via the two files you have mentioned, I need to make change in the
Change the public API Currently I'm checking the test case for this, will update if there is any change required to the test suite as well. Please let me know if my approach is appropriate. Regards |
@calcsam, my friend found a way to resolve this issue. But I didn't quite understand how this worked after seeing the To send data, he used the below method.
And at the resulting route
|
+1 Interested in having this feature as well. Looking forward to your implementation @SanthoshRaju91! Are you guys going to open a PR? |
I actually just realized I needed to do this when I couldn't get history state to work on a production site. #3802 will let you call navigateTo({
pathname: '/user',
state: {
user: 1,
name: 'John Doe',
},
}) |
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
likePlease 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.The text was updated successfully, but these errors were encountered: