sakelar tidak diekspor dari react-router-dom
/*Step 1: Step 1. Upgrade to React 16.8+ and react-router-dom v6+ */
npm uninstall react-router-dom
npm install react-router-dom
/*Step 2: Update the react-router-dom import statement.*/
//Change import { Switch, Route } from "react-router-dom";
//to
import { Routes ,Route } from 'react-router-dom';
/*Step 3: Upgrade the syntax and replace "Switch" with "Routes" and "component" with "element" */
//Change
// <Switch>
// <Route path="/home" component={HomePage} />
// </Switch>
//to
<Routes>
<Route path="/home" element={<HomePage/>} />
</Routes>
//Alternatively you can also downgrade the react-router-version as suggested in other solutions,
//However, rather than going backwards, I would suggest to upgrade to latest version of react-router-dom and its syntax.
MoreOnFew.com