Last active
July 10, 2020 06:47
-
-
Save mcjcloud/f7d5bb7f7b8ccbd5e58fcc5bddccd042 to your computer and use it in GitHub Desktop.
Asterisk Medium Article: App.tsx
This file contains 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
// App component | |
// this component renders the entire app inside the Provider and Router | |
const App = (): JSX.Element => { | |
const classes = useStyles() | |
return ( | |
<Provider store={store}> | |
<Router> | |
<div className={classes.app}> | |
{/* nav bar */} | |
<Navbar /> | |
{/* switch -- this finds the first route that matches the current url and renders its component (see routes.ts) */} | |
<Switch> | |
{routes.map((props, i) => <Route key={`route_${i}`} {...props} />)} | |
</Switch> | |
</div> | |
</Router> | |
</Provider> | |
) | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment