Switch Was Not Found in React Router Dom

Imported and tried to use the Switch as in the following; import { Switch, Route } from 'react-router-dom' class App extends React.Component { ... ... render() { return ( .... <Switch> <Route exact ...> <Switch> .... ) } } But it threw the error mentioned in the title. Looks like the project has some breaking changes starting from v6.x So, either you update <Switch /> elements to <Routes />, for details have a look this link, or you can just rollback the react-router-dom version to the latest v5 which currently is v5....

November 16, 2021 · 1 min · Ahmet Gokdayi