Install router
npm install –save react-router-dom
yarn add react-router-dom
In the index.js
import { BrowserRouter as Router, Route } from “react-router-dom”;
ReactDOM.render(
<Providerstore={createStore(allReducers, applyMiddleware(thunk))}>
<React.StrictMode>
<Router>
<Routepath=”/”exactcomponent={Home}/>
<Routepath=”/login”exactcomponent={Login}/>
<Routepath=”/signup”exactcomponent={Signup}/>
<Routepath=”/profile”exactcomponent={ProfilePage}/>
<Routepath=”/about”exactcomponent={AboutPage}/>
<Routepath=”/photos”exactcomponent={PhotosPage}/>
<Routepath=”/friends”exactcomponent={FriendsPage}/>
</Router>
</React.StrictMode>
</Provider>,
document.getElementById(‘root’)
);