react router v4 - How can I add properties to the target component when rendering a RouteWithSubRoutes component? -


in v4 of react router how can supply custom properties component use on matched route? example if using routewithsubroutes shown in recursive example of docs

const routewithsubroutes = (route) => (     <route path={route.path} render={props => (         // pass sub-routes down keep nesting         <route.component {...props} routes={route.routes}/>     )}/> ); 

how can add properties target component when rendering routewithsubroutes component?

      <routewithsubroutes key={i} {...route} /> 

in v2 use react.cloneelement(this.props.children, {extraprops:'go here', and:'here'}) in target component of main route had subroutes.

i think children not nested target components in v2 anymore.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -