var React = require('react');

/**
 * A mixin for components that need to know the routes, URL
 * params and query that are currently active.
 */
var ActiveState = {

  contextTypes: {
    activeRoutes: React.PropTypes.array.isRequired,
    activeParams: React.PropTypes.object.isRequired,
    activeQuery: React.PropTypes.object.isRequired,
    isActive: React.PropTypes.func.isRequired
  },

  /**
   * Returns an array of the routes that are currently active.
   */
  getActiveRoutes: function () {
    return this.context.activeRoutes;
  },

  /**
   * Returns an object of the URL params that are currently active.
   */
  getActiveParams: function () {
    return this.context.activeParams;
  },

  /**
   * Returns an object of the query params that are currently active.
   */
  getActiveQuery: function () {
    return this.context.activeQuery;
  },

  /**
   * A helper method to determine if a given route, params, and query
   * are active.
   */
  isActive: function (to, params, query) {
    return this.context.isActive(to, params, query);
  }

};

module.exports = ActiveState;

@@ -135,16 +135,371 @@
 active.%0A
+ *%0A * Example:%0A *%0A *   var AboutLink = React.createClass(%7B%0A *     mixins: %5B Router.ActiveState %5D,%0A *     render: function () %7B%0A *       var className = this.props.className;%0A *   %0A *       if (this.isActive('about'))%0A *         className += ' is-active';%0A *   %0A *       return React.DOM.a(%7B className: className %7D, this.props.children);%0A *     %7D%0A *   %7D);%0A
  */%0Avar 

Add example to doc comment