lib/Router.js
function createRouter(name, component) {

  return CreateReactClass({

    mixins: [RouterMixin, RouteRenderingMixin],

    displayName: name,

    propTypes: {
      component: PropTypes.oneOfType([
        PropTypes.string,
        PropTypes.element,
        PropTypes.func
      ])
    },

    getRoutes: function(props) {
      return props.children;
    },

    getDefaultProps: function() {
      return {
        component: component
      };
    },

    render: function() {
      // Render the Route's handler.
      var handler = this.renderRouteHandler();

      if (!this.props.component) {
        return handler;
      } else {
        // Pass all props except this component to the Router (containing div/body) and the children,
        // which are swapped out by the route handler.
        var props = assign({}, this.props);
        props = omit(props, PROP_KEYS);
        return React.createElement(this.props.component, props, handler);
      }
    }
  });
}
function createRouter(name, component) {

  return CreateReactClass({

    mixins: [RouterMixin, RouteRenderingMixin],

    displayName: name,

    propTypes: {
      component: PropTypes.oneOfType([
        PropTypes.string,
        PropTypes.element,
        PropTypes.func
      ])
    },

    getRoutes: function(props) {
      return props.children;
    },

    getDefaultProps: function() {
      return {
        component: component
      };
    },

    render: function() {
      // Render the Route's handler.
      var handler = this.renderRouteHandler();

      if (!this.props.component) {
        return handler;
      } else {
        // Pass all props except this component to the Router (containing div/body) and the children,
        // which are swapped out by the route handler.
        var props = assign({}, this.props);
        props = omit(props, PROP_KEYS);
        return React.createElement(this.props.component, props, handler);
      }
    }
  });
}
function createRouter ( name , component ) { return CreateReactClass ( { mixins : [ RouterMixin , RouteRenderingMixin ] , displayName : name , propTypes : { component : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . element , PropTypes . func ] ) } , getRoutes : function ( props ) { return props . children ; } , getDefaultProps : function ( ) { return { component : component } ; } , render : function ( ) { // Render the Route's handler. var handler = this . renderRouteHandler ( ) ; if ( ! this . props . component ) { return handler ; } else { // Pass all props except this component to the Router (containing div/body) and the children, // which are swapped out by the route handler. var props = assign ( { } , this . props ) ; props = omit ( props , PROP_KEYS ) ; return React . createElement ( this . props . component , props , handler ) ; } } } ) ; }
Create a new router class

@param {String} name
@param {ReactComponent} component
Create a new router class