TypeError: Cannot read property 'match' of undefined when using useParams from react-router
You can only use useParams
in a component that is a child of your Router
component, but App
is the parent in your case.
The Router
component injects the context containing the match
into the tree below it which will be read by the useParams
hook by internally using the useContext
hook.