Created
December 21, 2017 16:15
-
-
Save ydatech/aeea76f7513a37e830b3afb63764166b to your computer and use it in GitHub Desktop.
Root Component for React JS tutorial on https://learnreact.blogspot.com
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 React, { Component } from 'react'; | |
| // material-ui components | |
| import Grid from 'material-ui/Grid'; | |
| // react-router-dom | |
| import { | |
| BrowserRouter as Router, | |
| Route, | |
| Switch | |
| } from 'react-router-dom'; | |
| // pages | |
| import Home from './pages/Home'; | |
| import EditTodo from './pages/EditTodo'; | |
| import NotFound from './pages/NotFound'; | |
| class App extends Component { | |
| render() { | |
| return ( | |
| <Router> | |
| <div style={{ padding: 8 }}> | |
| <Grid container spacing={16} justify="center"> | |
| <Switch> | |
| <Route exact path="/" component={Home} /> | |
| <Route path="/edit/:id" component={EditTodo} /> | |
| <Route component={NotFound} /> | |
| </Switch> | |
| </Grid> | |
| </div> | |
| </Router > | |
| ); | |
| } | |
| } | |
| export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment