React Router is a standard library for routing in React that enables you to switch between views in your application.
How to install React Router
First you would need to create a react app
If you are writing a React Native application, replace -dom with -native
In your App.js file, import the router
BrowserRouter is the parent component that contains the other components, it keeps your UI in sync with the URL.
Switch is used to render only the first route that matches the location.
Route is used to conditionally show component that renders some UI when its path matches the current URL.
To link to other paths in application or website use the link component, this is used to navigate to different routes in your application just like the HTML anchor tag
And boooom! You can successfully switch between views and also click on links.