title: How to use React Router's redirect function?
body: <p>I want to configure React Router in the following way. If a certain route is matched the user is redirected to another one. <a href="https://github.com/rackt/react-router/blob/b06d1db7864ba16e36dc7bdae40e18ed86d23907/docs/Glossary.md#enterhook" rel="nofollow noreferrer">Documentation</a> states that it is possible, but doesn't provide the exact way to achieve that. Does anyone have insight on this?</p>
  
  <pre class="lang-js prettyprint-override"><code>type EnterHook = (nextState: RouterState, replaceState: RedirectFunction, callback?: Function) =&gt; any;
  
  type RedirectFunction = (state: ?LocationState, pathname: Pathname | Path, query: ?Query) =&gt; void;
  </code></pre>