Created
September 1, 2016 02:50
-
-
Save rafaelrinaldi/bde085f86eef6d8342437807e66dac9f to your computer and use it in GitHub Desktop.
My own routes structure
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
import React from 'react'; | |
import {render} from 'react-dom'; | |
import configureStore from './configure-store'; | |
import Root from './components/root'; | |
const store = configureStore(); | |
render( | |
<Root store={store} />, | |
document.querySelector('[data-app]') | |
); |
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
import React, {PropTypes} from 'react'; | |
import {Provider} from 'react-redux'; | |
import Routes from '../../routes'; | |
const Root = ({store}) => { | |
return ( | |
<Provider store={store}> | |
<Routes /> | |
</Provider> | |
); | |
}; | |
Root.propTypes = { | |
store: PropTypes.object.isRequired, | |
}; | |
export default Root; |
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
import React from 'react'; | |
import {Router, Route, IndexRoute} from 'react-router'; | |
import route from './route'; | |
import App from '../components/app'; | |
import Home from '../components/home'; | |
import About from '../components/about'; | |
import Contact from '../components/contact'; | |
const Routes = () => ( | |
<Router> | |
<Route component={App} path='/'> | |
<IndexRoute component={Home} /> | |
<Route component={About} path='/about'} /> | |
<Route component={Contact} path='/contact' /> | |
</Route> | |
</Router> | |
); | |
export default Routes; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment