Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import {Router, browserHistory} from 'react-router';
  4. import routes from './routes';
  5.  
  6. ReactDOM.render(
  7. <Router history={browserHistory} routes={routes}/>, document.getElementById('root'));
  8.  
  9. module.exports = {
  10. path: '/',
  11. component: require('../components/app'),
  12. indexRoute: require('./home')
  13. };
  14.  
  15. module.exports = {
  16. getComponent(nextState, cb) {
  17. require.ensure([], (require) => {
  18. cb(null, require('../components/home'));
  19. });
  20. }
  21. };
  22.  
  23. import React, {PropTypes} from 'react';
  24.  
  25. const App = props => (
  26. <section>
  27. <h1>My App</h1>
  28. <section>{props.children}</section>
  29. </section>
  30. );
  31.  
  32. App.propTypes = {
  33. children: PropTypes.node.isRequired
  34. };
  35.  
  36. export default App;
  37.  
  38. import React from 'react';
  39.  
  40. const Home = () => (
  41. <section>
  42. <h3>Home</h3>
  43. </section>
  44. );
  45.  
  46. export default Home;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement