This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const NavBar = () => ( | |
| <ul> | |
| <li> | |
| <Link to="/">Home</Link> | |
| </li> | |
| <li> | |
| <Link to="/admin">Admin</Link> | |
| </li> | |
| </ul> | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { BrowserRouter as Router, Route, Link } from 'react-router-dom'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Route | |
| path="/children" | |
| children={props => { | |
| console.info(props); | |
| return null; | |
| }} | |
| /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Route path="/children" children={({match}) => { | |
| if(match) { | |
| return <h1>Children</h1>; | |
| } | |
| return null; | |
| }} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Route path="/children" children={() => <h1>Children</h1>} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Route strict path="/logs" render={() => <h1>Logs</h1>} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Route, Redirect } from 'react-router' | |
| <Route exact path="/" render={() => ( | |
| loggedIn ? ( | |
| <Redirect to="/admin"/> | |
| ) : ( | |
| <Home/> | |
| ) | |
| )}/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Route exact path="/" component={Home} /> | |
| <Route strict path="/admin/" component={Admin} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Route exact path="/" component={Home} /> | |
| <Route path="/admin" component={Admin} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Route path="/" component={Home} /> | |
| <Route path="/admin" component={Admin} /> |