React Route

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’)
);

 

 




Subscribe To Our Newsletter
You will receive our latest post and tutorial.
Thank you for subscribing!

required
required


Leave a Reply

Your email address will not be published. Required fields are marked *