React: Can I check if a state exists before rendering it
<p>I'm new to React and I've made a navbar that displays the users name user </p>

<pre><code>&lt;NavItem eventKey={4} href="#"&gt;{this.state.name}&lt;/NavItem&gt;
</code></pre>

<p>but the problem is if the user is not signed in, I get an error due to this.state.name being undefined.  Is there some way I can check if this.state.name is defined before rendering it as part of the navbar or is there a better way to get rid of this error?</p>