how to work react router another component
import React, { Fragment } from "react";
import "./index.css"
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
export default function App() {
const name = 'John Doe'
const isAuthenticated = false
return (
<Router>
<main>
<nav>
<ul>
<li><Link to="/">Home</Link></li>
<li><Link to={`/about/${name}`}>About</Link></li>
<li><Link to="/contact">Contact</Link></li>
</ul>
</nav>
<Switch>
<Route path="/" exact component={Home} />
{
isAuthenticated ?
<>
<Route path="/about/:name" component={About} />
<Route path="/contact" component={Contact} />
</> : <Redirect to="/" />
}
</Switch>
</main>
</Router>
);
}
Also in JavaScript:
- vue axios catch error
- how to get header in all the pages in visualforce page
- mapbox blurry popup
- movement of objects in javascript
- refresh a div jquery
- codeigniter csrf token ajax
- javascript bind multiple arguments
- A fatal JavaScript error has occurred. Should we send an error report
- how to disable right click in javascript
- prevent specific state redux-persist
- adonis js
- for Loop continue
- javascript sleep function
- too many open files react native
- create csv file javascript
- fire off some javascript on page load
- angular datatable reload with pagination
- javascript fs write file with folder
- two object combine together javascript
- javascript code to loop through array
- how to sent react from data in mongodb
- javascript compare and sort strings alphabetically
- slider js
- node path resolve