Skip to content

Instantly share code, notes, and snippets.

@mcjcloud
Last active July 10, 2020 06:47
Show Gist options
  • Save mcjcloud/f7d5bb7f7b8ccbd5e58fcc5bddccd042 to your computer and use it in GitHub Desktop.
Save mcjcloud/f7d5bb7f7b8ccbd5e58fcc5bddccd042 to your computer and use it in GitHub Desktop.
Asterisk Medium Article: App.tsx
// 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