ScanSkill

Routes

The Routes component replaces the Switch component from React Router v5. Routing helps to switch between the pages. It displays the page that is linked with the provided path in the URL. The Route components are wrapped inside the Routes component.

Syntax

<Routes>
		//Route components here...
</Routes>

Example

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

function App() {
  return (
    <BrowserRouter >
        <Routes>                                   // declaring routes
           <Route path="/" element={<Home />} />
           <Route path="/about" element={<About />} />
           <Route path="/contact" element={<Contact/>} />
       </Routes>
    </BrowserRouter>
  );
}