npm install react-router-dom // install on your project.. can add specific version by adding @6 at the end
// edit the index.js and import react router
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
// import the location of the components
import { App, About, Contact } from "./App";
import {BrowserRouter, Route, Routes} from "react-router-dom"
ReactDOM.render(
<BrowserRouter>
// Use Routes to set the correct route of each component
<Routes>
<Route path="/" element={<App />} /> // Route Identify the component and the link you want to use or path to use.
<Route path="/about" element={<About />} />
<Route path="/contact" element={<Contact />} />
</Routes>
</BrowserRouter>,
document.getElementById("root")
);
// Create links
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter