UNPKG

react-crossroads

Version:

Client side router for web applications built with React and utilizing the Flux architecture. The backing routing engine is CrossroadsJs.

49 lines (35 loc) 1.37 kB
var DefaultRoute, React, RouteDefinition, TYPE, factory, merge, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; React = require('react'); RouteDefinition = require('./RouteDefinition'); merge = require('react/lib/merge'); TYPE = 'DefaultRoute'; DefaultRoute = (function(_super) { __extends(DefaultRoute, _super); DefaultRoute.prototype.type = TYPE; function DefaultRoute(props) { var defaultProps; defaultProps = { handlerProps: {}, path: '' }; this.props = merge(defaultProps, props); DefaultRoute.__super__.constructor.call(this); } DefaultRoute.prototype.propTypes = { handler: RouteDefinition.PropTypes.componentClass.isRequired, name: React.PropTypes.string, path: React.PropTypes.string, handlerProps: React.PropTypes.object.isRequired }; return DefaultRoute; })(RouteDefinition); factory = function(props) { if (arguments.length > 1) { throw new Error('DefaultRoute does not support children, use <Routes /> instead'); } return new DefaultRoute(props); }; factory.type = TYPE; module.exports = factory;