I am trying to pass an object to a class component via the router. The browser doesn't display any error, but I don't know how reach the object It's worked when I user the v5, but not with the v6 All the answers available on the subject are for the case you use functional component
<Link to={`myPath`} state={{ myObject }}>
....
</Link>
Thank you
CodePudding user response:
The way you are passing the state object is incorrect. Please try like this
<Link
to={{
pathname: "/myPath",
state: myObject
}}
/>
....
</Link>
for more information refer :