‘ react-router ’ came with their new v6 beta version. You’ll face a problem with “switch” in the new version. If You’re facing the same problem that I mentioned and want to use the previous version follow the steps below…
- go to the package.json file.
- check your version of react-router and react-router-dom. (if the version is above 5 then follow the next steps )
- go to the command line.
npm uninstall --save react-router react-router-dom
(it will uninstall yours react-router & react-router-dom. To install them again with 5 Version use next two commands)
npm install react-router@5
npm install react-router-dom@5
Now you’re all set to proceed. I prefer using the previous version until you figure out the new version.