title: Get an active route with react-router in ReactJs
body: <p>I am creating a project using reactjs.In my application i am getting the active route using this:</p>
  
  <pre><code>this.context.router.isActive
  </code></pre>
  
  <p>but getting undefined, i am using the react-router 4.Earlier this was worked for me when am using the lower version of react-router.
  Here is my code:</p>
  
  <pre><code>class NavLink extends React.Component {
  
      render() {
  
  
       console.log( this.context.router.isActive)
            let isActive = this.context.router.isActive(this.props.to, true);
             let className = isActive ? "active" : "";
          return(
              &lt;li  className={className} {...this.props}&gt;
                 &lt;Link {...this.props}/&gt;
              &lt;/li &gt;
          );
      }
  }
  
  NavLink.contextTypes = {
      router: PropTypes.object
  };
  </code></pre>