title: "TypeError: Cannot read property 'name' of undefined" error
body: <p>The code gives me this "TypeError: Cannot read property 'name' of undefined" error although when I console.log it it gives me the object</p>
  
  <pre><code>import React from "react";
  
  class Random extends React.Component {
    constructor(props) {
      super(props);
      this.state = {
        breweries: []
      };
    }
  
    componentDidMount() {
      fetch("https://api.openbrewerydb.org/breweries")
        .then(response =&gt; response.json())
        .then((data) =&gt; {
          this.setState({
            breweries: data,
          })
        })
    }
  
    render() {
      const brewery = this.state.breweries[Math.floor(Math.random()*this.state.breweries.length)];
      return(
        &lt;div&gt;{brewery.name}&lt;/div&gt;
      )
    }
  }
  
  export default Random;
  </code></pre>