Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Error importing Switch when using create-react app

Image of the Error shown

I really do not know how to resolve this issue. I need help…

the Error states; "export ‘Switch’ (imported as ‘Switch’) was not found in ‘react-router-dom’ (possib:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I can’t create a link tag in react due to this error. I do need help with this…

the error is cleared anytime I remove the switch tag but the link doesn’t still work.

>Solution :

In react-router-dom v6, Switch is replaced by Routes.
You need to update the import from

import { Switch, Route } from "react-router-dom";

to

import { Routes ,Route } from 'react-router-dom';

react-router-v6

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading