Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attempted import error: 'useLocation' is not exported from 'react-router-dom'

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 ?

like image 386
will Avatar asked Dec 30 '25 16:12

will


1 Answers

That hook was added in 5.1.0.

like image 162
ray hatfield Avatar answered Jan 02 '26 07:01

ray hatfield



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!