As you can see, it is very easy to implement the React Router library. Now we can add more routes for our About (/about) and Contact (/contact) components:
// Dependenciesimport React from 'react';import { Route, Switch } from 'react-router-dom';// Componentsimport App from './components/App';import About from './components/About';import Contact from './components/Contact';import Home from './components/Home';import Error404 from './components/Error/404';const AppRoutes = () => ( <App> <Switch> <Route path="/" component={Home} exact /> <Route path="/about" component={About} exact /> <Route path="/contact" component={Contact} exact /> <Route component={Error404} /> </Switch> </App>);export default AppRoutes;
If you go to