Redirect with a message
Answered
shadow posted this in #help-forum
shadowOP
Hey devs, whats is the best way to redirect to a page and show a message/toast in that page?
i know i could use query parameters but thats ugly, so i want a more clean way
i know i could use query parameters but thats ugly, so i want a more clean way
Answered by bscdev#1145
It depends whether you want to use it in your server components or client components. There is no such best way , strictly you have to follow nextjs documentation. https://nextjs.org/docs/app/api-reference/functions/redirect . For toast message if you use lots of javascripts then write it in a client component. If you want to use server components to show your toast message then choose a 3rd party package which mounts in a server component. like : 'react-hot-toast'
1 Reply
It depends whether you want to use it in your server components or client components. There is no such best way , strictly you have to follow nextjs documentation. https://nextjs.org/docs/app/api-reference/functions/redirect . For toast message if you use lots of javascripts then write it in a client component. If you want to use server components to show your toast message then choose a 3rd party package which mounts in a server component. like : 'react-hot-toast'
Answer