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

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -