title: I can't implement Redirect in React
body: <p>I want to redirect to the home page when some condition returns null or false but the action of Redirect is not triggered.</p>
  
  <pre><code>import { Link, Redirect } from "react-router-dom";
  
  if(localStorage.getItem("example") === null || localStorage.getItem("example") === false){
      return &lt;Redirect to="/" /&gt;
  }
  </code></pre>
  
  <p>I put this code inside in a simple function triggered in one <code>OnClick</code> and <code>componentDidMount()</code>, but it's not working.</p>