Link state prop
Is there an example of how to use the state property on a link component / navigate function? Also, I'm not sure if that's the place to pass additional data not included in the URL between routes or if there's another recommended way of doing that.
5 Replies
ambitious-aqua•3y ago
No example yet, but you should be able to just pass a
state: {} property to either <Link state={{}}> or navigate({ state: {}})automatic-azureOP•3y ago
Sounds great I'll try that. Thanks.
I tried supplying a state object like this:
And was using to read it on the resulting page, but can only seem to log an id like this:
ambitious-aqua•3y ago
Looks like a bug. Will you file an issue?
automatic-azureOP•3y ago
Yeah, I'll get an issue created. Thanks for the help.
automatic-azureOP•3y ago
GitHub
Link state missing on navigation · Issue #445 · TanStack/router
Describe the bug The Link/navigate state property doesn't pass the state to the provided route on navigation. Your Example Website or App https://stackblitz.com/edit/github-hqyitv?file=src%...