
<Link to={{pathname:"/Watch", movie:movie}} >
using this to pass props over Watch page but can't get any value.
I am new to react so there might be silly mistake or might be insufficient information. please let me know regarding any extra info
If you are using react-router-dom v5 then route state is a property on the to object of the Link.
RRDv5 Link
<Link to={{ pathname: "/Watch", state: { movie } }}>...</Link>
If using react-router-dom v6 then state is a top-level prop.
RRDv6 Link
<Link to="/Watch" state={{ movie }}>...</Link>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With