Attempted import error: 'useRouteMatch' is not exported from 'react-router-dom'
I Solved updating react-router-dom
to a version greater than 5.1
npm install [email protected] --save
Dont forget to boot the app again with npm start
to see the changes.
I had the same issue, for me I just needed to update the version of react-router I was using.
useRouteMatch
was added with react-router V5.1 https://reacttraining.com/blog/react-router-v5-1/#useroutematch
Update your package.json to "react-router-dom": "^5.1.2",
Delete node modules and run npm install
Simply update your react-router-dom
version to latest.
npm i react-router-dom@latest
If upgrading from v5 to v6, replace useRouteMatch
with useMatch
per the upgrade guide...
https://reactrouter.com/docs/en/v6/upgrading/v5#replace-useroutematch-with-usematch