title: React Router Wrap Multiple Routes in a Redirect
body: <p>Given an authentication token and a function <code>checkToken</code> how would I go about rerouting from multiple routes using the react router to prevent repetition like the below?</p>
  
  <pre><code>&lt;Route exact path="/" render={() =&gt; {
    return checkToken() ? (&lt;Dashboard /&gt;) : (&lt;Redirect to="/login" /&gt;)
  }} /&gt;
  &lt;Route exact path="/about" render={() =&gt; {
    return checkToken() ? (&lt;About /&gt;) : (&lt;Redirect to="/login" /&gt;)
  }} /&gt;
  </code></pre>
  
  <p>It gets cumbersome if I have a couple dozen routes to have this repeated.</p>
  
  <p>Surely there must be a better way!</p>