0

Is it possible in next/router to pass some additional data to the next route with router.push?

For example,

router.push('/my-route', {
    custom: {
       displayError: true
    }
});

Obviously, I added that custom, but that's the behaviour I want.

AngularDebutant
  • 1,436
  • 5
  • 19
  • 41
  • I think only the options specified on [docs](https://nextjs.org/docs/api-reference/next/router#routerpush) can be configured or passed using router.push. For other data-passing scenarios, you are better off with `React-context`, Redux and my recent favorite `jotai`. – KeshavDulal Dec 03 '21 at 11:26
  • Does this answer your question: [How to pass state between routes in NEXT JS?](https://stackoverflow.com/questions/66513773/how-to-pass-state-between-routes-in-next-js)? That's not possible with `next/router`, but you can use the query string to pass values. – juliomalves Dec 03 '21 at 20:12

0 Answers0