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 ?
CodePudding user response:
That hook was added in 5.1.0.
CodePudding user response:
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