Checking authentication in React
<p>How do I check if user is authenticated in my React component?</p>

<pre><code>class MyComponent extends Component {

   var isAuthenticated = false; // How do I check if the user is authenticated?
   var message = "Hello stranger!";

   if(isAuthenticated) {
      message = "Hello friend!";
   }

   render() {
      return(
         &lt;div&gt;
             {message}
         &lt;/div&gt;
      );
   }
}
</code></pre>