Check if Logged in - React Router App ES6 : <p>I am writing a <strong>React</strong>.js application (v15.3) using <strong>react-router</strong> (v2.8.1) and <strong>ES6 syntax</strong>. I cannot get the router code to intercept all transitions between pages to check if the user needs to login first.</p>

<p>My top level render method is very simple (the app is trivial as well):</p>

<pre><code> render()
   {
      return (
         &lt;Router history={hashHistory}&gt;
            &lt;Route path="/" component={AppMain}&gt;
               &lt;Route path="login" component={Login}/&gt;
               &lt;Route path="logout" component={Logout}/&gt;
               &lt;Route path="subject" component={SubjectPanel}/&gt;
               &lt;Route path="all" component={NotesPanel}/&gt;
            &lt;/Route&gt;
         &lt;/Router&gt;
      );
   }
</code></pre>

<p>All the samples on the web use ES5 code or older versions of react-router (older than version 2), and my various attempts with mixins (deprecated) and willTransitionTo (never gets called) have failed.</p>

<p>How can I set up a global 'interceptor function' to force users to authenticate before landing on the page they request?</p>
