T
TanStack3y ago
variable-lime

how to navigate upon action success?

I use @tanstack/react-actions to submit a form. How can I navigate away when the action was completed successfully?
3 Replies
foreign-sapphire
foreign-sapphire3y ago
submit returns a promise that you can await, then use the router.navigate or useNavigate to programmatically navigate.
extended-salmon
extended-salmon3y ago
This is how I use it after I successfully create an invoice, we then navigate to that invoice id @Tanner Linsley when we create the navigate function with useNavigate, do we have to give it a "from" property? I was under the impression we did since we give it a "to" property.
No description
foreign-sapphire
foreign-sapphire3y ago
If you don't, it assumes you need to pass an absolute path. If you do, your typesafety will just get better But it's not required in every case

Did you find this page helpful?