Skip to content

Instantly share code, notes, and snippets.

@rafaelrinaldi
Created September 1, 2016 02:50
Show Gist options
  • Save rafaelrinaldi/bde085f86eef6d8342437807e66dac9f to your computer and use it in GitHub Desktop.
Save rafaelrinaldi/bde085f86eef6d8342437807e66dac9f to your computer and use it in GitHub Desktop.
My own routes structure
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]')
);
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;
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