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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -