I am trying to send an object from one react component to another. I have tried the exact same thing as here, react-router-dom v6 useNavigate passing value to another component, but it works only for Strings or Integers. If I have a more complex object, instead of receiving it, I receive Object:object. Is anything there that I'm missing?
Asked
Active
Viewed 143 times
1
-
Try sending the object, in string form, using JSON.stringify, and then parse it back into the JSON within the component, using JSON.parse – Charchit Kapoor May 22 '22 at 17:00
-
For objects you can also use simple state management tools like zustand (https://github.com/pmndrs/zustand) – acetheninja May 22 '22 at 18:06