0

I am using App router and I want to pass parameters as object without using useParams & useSearchParams

If I were to have a object say person

const person: Person = {
  name: "John Doe",
  age: 25,
  address: "123 Main St",
};

I want to send person object from one route to another lets say from /home to /person

Persently as per my limited knowledge you can move from one route to another using

  1. router.push()
  2. Link's href

But I cannot see any argument were I can pass the complete object

krishnaacharyaa
  • 14,953
  • 4
  • 49
  • 88
  • 1
    I think you should use sessionStorage or some global state manager like context or redux or mobx. You can read from this link to know that there is current no way to pass prop between router https://github.com/vercel/next.js/discussions/17008 Sorry that if you're already know what I comment – Phong Vũ Jul 11 '23 at 10:54

0 Answers0