title: TypeError: Cannot read property 'first_name' of null in react
body: <pre><code>  export function UserDisplay(props) {
      const {user, includeFullName} = props
      const nameDisplay = includeFullName === true ? `${user.first_name} ${user.last_name}` : null  
  
      return &lt;React.Fragment&gt;
            {nameDisplay}
        &lt;/React.Fragment&gt;
    }
  </code></pre>
  <p>Here when i check the value it comes here like:</p>
  <pre><code>const name = user.first_name
  console.log(name)
  </code></pre>
  <p>it prints the log but not work in the code why???</p>
  <pre><code> const nameDisplay = includeFullName === true ? `${user.first_name} ${user.last_name}` : null
  </code></pre>
  <p>It gets error <code>TypeError: Cannot read property 'first_name' of null</code></p>