Next.js Discord

Discord Forum

Passing data between routes Nextjs (without next/router)

Unanswered
Rex posted this in #help-forum
Open in Discord
RexOP
Hi, do you know how can i pass data between routes with next/navigation or something else?

For example let's say I'm in /homepage and when the user clicks on a button it redirect him to /book/new.
Is it possible to pass value to that new route without:
using the params (cause in this case user can see in the url bar and edit it)
fetching data from database in /book/new page

In simple words:
I need to pass data between routes without letting the user see that, and without doing requests

1 Reply

Toyger
as one of the ways you can run serveraction that will set cookies with your needed value and then redirect to needed page.