import invariant from 'invariant'; import React from 'react'; import BaseRoute from 'react-router/lib/Route'; import LoadingIndicator from './LoadingIndicator'; // This is not a component. /* eslint-disable react/prop-types */ function render({ props, element }) { if (!props) { return ; } if (this.renderFetched) { return this.renderFetched(props); } return React.cloneElement(element, props); } /* eslint-enable react/prop-types */ function createRoute(element) { const route = BaseRoute.createRouteFromReactElement(element); if (!route.render && (route.queries || route.getQueries)) { route.render = render; } return route; } function Route() { invariant(false, '`` should not be rendered.'); } Route.createRouteFromReactElement = createRoute; export default Route; function createIndexRoute(element, parentRoute) { invariant(parentRoute, 'An `` must have a parent.'); /* eslint-disable no-param-reassign */ parentRoute.indexRoute = createRoute(element); /* eslint-enable no-param-reassign */ } function IndexRoute() { invariant(false, '`` should not be rendered.'); } IndexRoute.createRouteFromReactElement = createIndexRoute; export { IndexRoute };