docs/assets/app.js
function createRoutesFromReactChildren(children, parentRoute) {
  var routes = [];

  _react2.default.Children.forEach(children, function (element) {
    if (_react2.default.isValidElement(element)) {
      // Component classes may have a static create* method.
      if (element.type.createRouteFromReactElement) {
        var route = element.type.createRouteFromReactElement(element, parentRoute);

        if (route) routes.push(route);
      } else {
        routes.push(createRouteFromReactElement(element));
      }
    }
  });

  return routes;
}
function createRoutesFromReactChildren(children, parentRoute) {
  var routes = [];

  _react2.default.Children.forEach(children, function (element) {
    if (_react2.default.isValidElement(element)) {
      // Component classes may have a static create* method.
      if (element.type.createRouteFromReactElement) {
        var route = element.type.createRouteFromReactElement(element, parentRoute);

        if (route) routes.push(route);
      } else {
        routes.push(createRouteFromReactElement(element));
      }
    }
  });

  return routes;
}
function createRoutesFromReactChildren ( children , parentRoute ) { var routes = [ ] ; _react2 . default . Children . forEach ( children , function ( element ) { if ( _react2 . default . isValidElement ( element ) ) { // Component classes may have a static create* method. if ( element . type . createRouteFromReactElement ) { var route = element . type . createRouteFromReactElement ( element , parentRoute ) ; if ( route ) routes . push ( route ) ; } else { routes . push ( createRouteFromReactElement ( element ) ) ; } } } ) ; return routes ; }
Creates and returns a routes object from the given ReactChildren. JSX
provides a convenient way to visualize how routes in the hierarchy are
nested.

import { Route, createRoutesFromReactChildren } from 'react-router'

const routes = createRoutesFromReactChildren(
<Route component={App}>
<Route path="home" component={Dashboard}/>
<Route path="news" component={NewsFeed}/>
</Route>
)

Note: This method is automatically used when you provide <Route> children
to a <Router> component.
Creates and returns a routes object from the given ReactChildren . JSX provides a convenient way to visualize how routes in the hierarchy are nested .