Reputation: 235
React version:
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-router-dom": "5.0.1",
"react-scripts": "3.4.0",
js code as
import {useLocation} from "react-router-dom";
const location = useLocation();
...... where is the problem ?
Upvotes: 2
Views: 7041
Reputation: 527
Try uninstalling and reinstalling the "react-router-dom" Then, for safety, run npm i
and npm start
. Also, if you're using TS, you have to also install "@types/react-router-dom" as a dev dependency
Upvotes: -1