{"action":"created","issue":{"url":"https://api.github.com/repos/davezuko/react-redux-starter-kit/issues/797","repository_url":"https://api.github.com/repos/davezuko/react-redux-starter-kit","labels_url":"https://api.github.com/repos/davezuko/react-redux-starter-kit/issues/797/labels{/name}","comments_url":"https://api.github.com/repos/davezuko/react-redux-starter-kit/issues/797/comments","events_url":"https://api.github.com/repos/davezuko/react-redux-starter-kit/issues/797/events","html_url":"https://github.com/davezuko/react-redux-starter-kit/issues/797","id":154260266,"number":797,"title":"Using fractal sub-routes with container components","user":{"login":"chrismllr","id":9942917,"avatar_url":"https://avatars.githubusercontent.com/u/9942917?v=3","gravatar_id":"","url":"https://api.github.com/users/chrismllr","html_url":"https://github.com/chrismllr","followers_url":"https://api.github.com/users/chrismllr/followers","following_url":"https://api.github.com/users/chrismllr/following{/other_user}","gists_url":"https://api.github.com/users/chrismllr/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismllr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismllr/subscriptions","organizations_url":"https://api.github.com/users/chrismllr/orgs","repos_url":"https://api.github.com/users/chrismllr/repos","events_url":"https://api.github.com/users/chrismllr/events{/privacy}","received_events_url":"https://api.github.com/users/chrismllr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-11T14:39:14Z","updated_at":"2016-05-11T16:31:03Z","closed_at":null,"body":"Hey guys - first off, wonderful work with the starter kit.. Has everything necessary to boot up what i feel is the most scalable react app possible.\r\n\r\nSecond, this more of a request or enhancement, so I apologize for the open issue... I've got a question open currently on stackoverflow [here](http://stackoverflow.com/questions/37150168/react-router-getchildroutes-not-firing-in-nested-plainroute/37153505#37153505). \r\n\r\nWould it be possible to include in the docs, or an example, of how to use nested fractal routes with PlainRoutes? You detail it subtly in the structure diagram...\r\n\r\n```\r\n│       └── Home             # Fractal route\r\n│           ├── index.js     # Route definitions and async split points\r\n│           ├── assets       # Assets required to render components\r\n│           ├── components   # Presentational React Components\r\n│           ├── container    # Connect components to actions and store\r\n│           ├── modules      # Collections of reducers/constants/actions\r\n│           └── routes **    # Fractal sub-routes (** optional)\r\n```\r\n\r\nAnd I am having trouble making it work if the top level (`Home`, in this case) is a `connect`ed container component. Any help or documentation would be appreciated!\r\n\r\nAlso, if there is clear documentation of this somewhere i've missed, please let me know and close issue accordingly.\r\n\r\nThanks again 👍 "},"comment":{"url":"https://api.github.com/repos/davezuko/react-redux-starter-kit/issues/comments/218514555","html_url":"https://github.com/davezuko/react-redux-starter-kit/issues/797#issuecomment-218514555","issue_url":"https://api.github.com/repos/davezuko/react-redux-starter-kit/issues/797","id":218514555,"user":{"login":"justingreenberg","id":1539088,"avatar_url":"https://avatars.githubusercontent.com/u/1539088?v=3","gravatar_id":"","url":"https://api.github.com/users/justingreenberg","html_url":"https://github.com/justingreenberg","followers_url":"https://api.github.com/users/justingreenberg/followers","following_url":"https://api.github.com/users/justingreenberg/following{/other_user}","gists_url":"https://api.github.com/users/justingreenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/justingreenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justingreenberg/subscriptions","organizations_url":"https://api.github.com/users/justingreenberg/orgs","repos_url":"https://api.github.com/users/justingreenberg/repos","events_url":"https://api.github.com/users/justingreenberg/events{/privacy}","received_events_url":"https://api.github.com/users/justingreenberg/received_events","type":"User","site_admin":false},"created_at":"2016-05-11T16:31:03Z","updated_at":"2016-05-11T16:31:03Z","body":"hey chris! `getChildRoutes` is only necessary if you need to implement some business logic—for example, conditionally loading a branch of sub-routes based off user permissions... otherwise, route definition modules can just be imported normally since async routes and split points are implemented in `getComponent`, which is lazily evaluated. From your example...\r\n\r\nOverview Route definition\r\n```js\r\nimport Overview from '../components/Overview'\r\nexport default { component: Overview }\r\n```\r\n\r\nNested Router Config (TSP):\r\n```js\r\nimport { injectReducer } from '../../store/reducers'\r\n\r\n// Simple route definition for index (above)\r\nimport OverviewRoute from './routes/Overview'\r\n\r\n// Async route definition factories for children that need access to store\r\nimport createOffersRoute from './routes/Offers'\r\nimport createReviewsRoute from './routes/Reviews'\r\n\r\nexport default (store) => (\r\n  path: '/tsp/:id',\r\n  indexRoute: OverviewRoute, // or just define as pojo { component: Overview } \r\n  childRoutes: [\r\n    createOverviewRoute(store),\r\n    createOffersRoute(store)\r\n  ],\r\n  getComponent (nextState, next) {\r\n    require.ensure([], (require) => {\r\n      const TSP = require('./containers/TSPContainer').default\r\n      const reducer = require('./modules/tsp').default\r\n\r\n      injectReducer(store, { key: 'tsp', reducer })\r\n\r\n      next(null, TSP);\r\n    })\r\n  }\r\n```\r\n\r\ni know this answer is light on explanation, but i just feel like code is worth 1000 words, so i hope this helps steer you in the right direction... let me know if you have any questions :)\r\n\r\n@davezuko i owe you some more documentation on this!"}}