Passing data between routes
I am using Tanstack Router and Tanstack Query.
Let's say we have a route that does a search. We have a form that accepts "code" as a search input. When the user click search, that value of the code is put into the url as search parameter and this useQuery is enabled.
We take the data and render the list as a table. Each row has an edit button, that will navigate to another route defined as
I also want to pass the initial data so that I do not have to fetch the detail with that id and so that I can populate the edit form.
What should be an ideal way to do it cleanly?
Let's say we have a route that does a search. We have a form that accepts "code" as a search input. When the user click search, that value of the code is put into the url as search parameter and this useQuery is enabled.
We take the data and render the list as a table. Each row has an edit button, that will navigate to another route defined as
/$id.I also want to pass the initial data so that I do not have to fetch the detail with that id and so that I can populate the edit form.
What should be an ideal way to do it cleanly?