title: Conditional rendering not displaying - ReactJS
body: <p>I have a log out button that I only want to show when the user is logged in. </p>
  
  <p>I have created a function for this purpose and included the function in the return part of react but it's not working.</p>
  
  <p>This is the function:</p>
  
  <pre><code>const ifloggedin = () =&gt; {
      if (!localStorage.hasOwnProperty('token')) {
        return null
  } else {
  return &lt;li&gt;&lt;a href="#contact" className="Contact" onClick={logout} to={"/"}&gt;Log Out&lt;/a&gt;&lt;/li&gt;
  }
    }
  </code></pre>
  
  <p>This is how I am trying to render it in return:</p>
  
  <pre><code>        &lt;div className="content"&gt;
            &lt;li&gt;&lt;a href="#hiw" className="Hiw" to={"/about"}&gt;HOW IT WORKS&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#pricing" className="Price" to={"/pricing"}&gt;PRICING&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;Link className="Faq" to={"/Faq"}&gt;FAQ&lt;/Link&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#contact" className="Contact" to={"/contact"}&gt;CONTACT&lt;/a&gt;&lt;/li&gt;
            {ifloggedin}
          &lt;/div&gt;
  </code></pre>