reactjs - React-router import routes -


i change this:

  <router history={browserhistory}>     <route path='/' component={layout}>       <route path='signup' component={signuppage} />       <route path='assemblies/' component={assemblypages}>         <route path='categories/' component={categories}>       </route>     </route>   </router> 

to

import assembliesroute './assembliesroute';     <router history={browserhistory}>     <route path='/' component={layout}>       <route path='signup' component={signuppage} />       <assembliesroute />     </route>   </router>  //assembliesroute.js  export default class extends compondent { render(){   return <route path='assemblies/' component={assemblypages}>             <route path='categories/' component={categories}>          </route> } } 

basically, want take of routes nested inside assemblies route, , deal them in specific file in assemblies folder, , return routes router. when try this, no route found. possible?

the problem react router cannot pass component wraps route.

so, if create component called assemblyroutes wraps assemblies, won't work.

what can pass function returns raw route components so:

//assemblyroutes     export default function(){      return <route ... >     } 

and call function in routes

import assemblyroutes 'assemblyroutes <router>  <route>   {assemblyroutes()}  </route> </router> 

and voila, can import routes main routes page.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -