index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // We only need to import the modules necessary for initial render
  2. import Layout from '../components/Layout'
  3. import Home from './Home'
  4. import NotFound from './NotFound'
  5. import CounterRoute from './Counter'
  6. /* Note: Instead of using JSX, we recommend using react-router
  7. PlainRoute objects to build route definitions. */
  8. export const createRoutes = (store) => ({
  9. path: '/',
  10. component: Layout,
  11. indexRoute: Home,
  12. childRoutes: [
  13. NotFound,
  14. CounterRoute(store)
  15. ]
  16. })
  17. /* Note: childRoutes can be chunked or otherwise loaded programmatically
  18. using getChildRoutes with the following signature:
  19. getChildRoutes (location, cb) {
  20. require.ensure([], (require) => {
  21. cb(null, [
  22. // Remove imports!
  23. require('./Counter').default(store)
  24. ])
  25. })
  26. }
  27. However, this is not necessary for code-splitting! It simply provides
  28. an API for async route definitions. Your code splitting should occur
  29. inside the route `getComponent` function, since it is only invoked
  30. when the route exists and matches.
  31. */
  32. export default createRoutes