Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

React Router Dom

//first install react router
npm install react-router-dom
//or
yarn add react-router-dom
///then write your code like in below in your App js or index.js
import {BrowserRouter , Routes , Route} from 'react-router-dom'
<BrowserRouter>
<Routes>
<Route exact path='/' element={<Home/>} />
<Route exact path='/login' element={<Login/>} />
<Route exact path='/signup' element={<Signup/>} />

</Routes>

</BrowserRouter>
//and now your down if you get error try to close your editor and open it again then you are good to go
Source by www.github.com #
 
PREVIOUS NEXT
Tagged: #React #Router #Dom
ADD COMMENT
Topic
Name
8+5 =