Read: Class 29 Component Composition - 401-advanced-javascript-muna/amman-javascript-401d1 GitHub Wiki
Using react-router, you can easily toggle the visibility of components (or even pages) based on the URL/Route that the user engages with.
import { Route } from 'react-router-dom';
To use Browser Router properly, you eliminate your use of <a>
tags and instead use it’s built-in <Link>
component.
`Home
Stuff`In practice, then, use the router component to look at either /
or /stuff
and based on that, displaying either the Home or the List component
<Route exact path="/" component={Home} /> <Route exact path="/stuff" render={() => <List>{items}</List>} />
you are sending your child components the raw data and allowing them to render the output as they decide.