React Router : Routing is a process in which a user is directed to different pages based on their action or request. ReactJS Router is mainly used for developing Single Page Web Applications. React Router is used to define multiple routes in the application. When a user types a specific URL into the browser, and if this URL path matches any 'route' inside the router file, the user will be redirected to that particular route.

Why do we need router
React Router is a standard library for routing in React.
It enables the navigation among views of various components in a React Application, allows changing the browser URL, and keeps the UI in sync with the URL. ... We will use React Router to navigate between these components.
Adding React Router Components: The main Components of React Router are:
1. BrowserRouter
2. Routes
3. Route:
4. Link:

BrowserRouter: BrowserRouter is a router implementation that uses the HTML5 history API(pushState, replaceState and the popstate event) to keep your UI in sync with the URL.
It is the parent component that is used to store all of the other components.

Routes: It’s a new component introduced in the v6 and a upgrade of the component.
The main advantages of Routes over Switch are: A router can take a routing decision much faster than a switch. It provides security measures to protect the network from security threats.
Route: Route is the conditionally shown component that renders some UI when its path matches the current URL.
Link: Link component is used to create links to different routes and implement navigation around the application. It works like HTML anchor tag.

Ex : import {
BrowserRouter as Router,
Routes,
Route,
Link
} from 'react-router-dom';