title: How to logout in react
body: <p>I'm trying to logout using this method:
  In render I have a div like this:</p>
  
  <pre><code>&lt;div&gt;
     &lt;a href="#" onClick={this.logout()}&gt;LOGOUT&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and the logout function:</p>
  
  <pre><code>logout() {
      // localStorage.clear();
      location.href = 'localhost:3000';
  }
  </code></pre>
  
  <p>At localhost:3000 I have the login page.</p>
  
  <p>Put when I press logout, nothing happends. What can I do?
  Thank you</p>