Attempted import error: 'useLocation' is not exported from 'react-router-dom'
See original GitHub issueSo, I tried to get the Animated Switch working, but I got this error message. I did some research and found out that useLocation is exported from react-router, but not react-router-dom. I switched the rrt
package to import from react-router instead and I got a Route that was positioned absolutely so that everything that is supposed to be beneath it was behind it.
Basically, my footer was up where it says “Projects”
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
'useLocation' is not exported from 'react-router-dom' - Stack ...
Try uninstalling and reinstalling the "react-router-dom" Then, for safety, run npm i ...
Read more >'uselocation' is not exported from 'react-router-dom'. - You.com
Attempted import error : 'useLocation' is not exported from 'react ... ... react-router-dom is a peer dependency, with a minimum major of 5....
Read more >How To Fix - "Attempted Import Error: 'Switch' is Not Exported ...
In this post, we will see How To Fix – “Attempted Import Error: 'Switch' is Not Exported From 'react-router-dom' in React.js, React-Router-Dom.
Read more >'useHistory' is not exported from 'react-router-dom' SOLVED
How to solve Attempted import error : 'useHistory' is not exported from 'react - router - dom ' and useHistory was not found...
Read more >How to Fix Attempted Import Error Switch is Not Exported From ...
Command:- npm install react - router - dom @5.3.0In This Video We Will See How to Fix Attempted Import Error Switch is Not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Simple solution inside your parent component that renders the route
useEffect(() => { window.scrollTo(0, 0); }, [])
Please update react-router-dom for the latest version!