Passing props to Link

Sometimes we may want to pass something more than just the route’s param or URL params into a component. Sure, we can extract the params that got us to render this component using useParams and do something like this:



But sometimes we may want to pass a bit more than that to the component we know will render when we send the user to another route with a <Link> URL params are constrained and limited to string. How would we pass something more complex like an object? The link components to prop, allows us to not only give it a string, but also an object like this:



How would we get that state object out within the component that renders on that pathnames route?


Copyright 2023 © Borja Leiva

Made within London