T
TanStack3y ago
optimistic-gold

How to redirect to a path with params?

I have a page like the following snapshot . Normally the user need to fill the table name and cluster name and then click the button. How to redirect to this page with table name and cluster name pre-filled? something like redirect to http://.../this_page?table_name=table1&cluster_name=cluster1, and hope to get the page with table/cluster pre-filled and only need to click a button
No description
2 Replies
extended-salmon
extended-salmon3y ago
you use the search attribute with navigate or Link
quickest-silver
quickest-silver3y ago
navigate({ to: '/page/you/need', search: d => ({ ...d. tableName: 'table1', clusterName: 'cluster1' }) }) Then pick up those search params in the route you need them Make sure to validate them as optional in that route's validateSearchParams option That way they'll be type-safe

Did you find this page helpful?