ReactJS

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

Attempted import error: 'Switch' is not exported from 'react-router-dom' - ReactJS, someone asked me to explain?
In this tutorial I will show you how to fix the following error in - ReactJS "Attempted import error: 'Switch' is not exported from 'react-router-dom' " 

To fix this problem:
I just uninstalled the version of react-router-dom 6.4.2 from my react project.

npm uninstall react-router-dom
and then installed react-router-dom version 5.2.

npm install react-router-dom@5.2.0

Related Article

Post your comments / questions