title: Why does the useEffect hook not see my object?
body: <pre><code>import React, { useState, useEffect } from &quot;react&quot;;
  
  const Person = () =&gt; {
      const [people, setPeople] = useState([]);
  
      useEffect(() =&gt; {
          setPeople(
              { name: &quot;Geoff&quot;, age: 51 },
              { name: &quot;Inity&quot;, age: 15 },
              { name: &quot;Iniko&quot;, age: 6 }
          );
      }, []);
  
      return (
          &lt;div&gt;
              &lt;p&gt;
                  {&quot; &quot;}
                  HI! My name is {people[0].name} and I'm {people[0].age} years
                  old!
              &lt;/p&gt;
              &lt;p&gt;
                  {&quot; &quot;}
                  HI! My name is {people[1].name} and I'm {people[1].age} years
                  old!
              &lt;/p&gt;
              &lt;p&gt;
                  {&quot; &quot;}
                  HI! My name is {people[2].name} and I'm {people[2].age} years
                  old!
              &lt;/p&gt;
          &lt;/div&gt;
      );
  };
  
  export default Person;
  </code></pre>
  <p>SO I KEEP GETTING THE ERROR</p>
  <blockquote>
  <p>TypeError: Cannot read property 'name' of undefined</p>
  </blockquote>