title: React cannot read properties of undefined inside conditional statement
body: <p>I'm fetching data from an API which returns an object that looks like this.</p>
  <pre><code>results: { 
      AT: {
            buy[],
            rent[]
  },
      US: {
            buy[],
            rent[]}
  }
  </code></pre>
  <p>And I'm having trouble checking whether the property US exists. This is resulting in a cannot read properties of undefined error. The way I'm attempting to do it looks like this.</p>
  <pre><code>{typeof(provider?.results.US.flatrate) !== undefined &amp;&amp; provider?.results.US.flatrate.map()}
  </code></pre>
  <p>The data is stored inside provider using the useState hook.</p>
  <pre><code>const [provider, setProvider] = useState&lt;Monetization&gt;();
  </code></pre>
  <p>The way I'm fetching data from the API looks like this.</p>
  <pre><code>axios.get(&quot;https://api.themoviedb.org/3/movie/&quot; + movieId +
              &quot;/watch/providers?api_key=my_key&quot;).then(res =&gt; setProvider(res.data));
  </code></pre>