title: React access state after render with functional components
body: <p>I'm a bit of a newbie with React functional components, I have a child and parent components with some state that gets updated with useEffect, which state apparently resets back to its initial values after render.</p>
  
  <p>Parent has a list of users it passes to its child:</p>
  
  <p>Parent:</p>
  
  <pre><code>const Parent = () =&gt; {
     const [users, setUsers] = useState([])
     const getUsers = () =&gt; {
     setUsers(["pedro", "juan"])
    }
      useEffect(() =&gt; {
          getUsers() 
      }, []);
  
     return &lt;div&gt; 
      &lt;Child users={users} /&gt; 
  }
  </code></pre>
  
  <p>Child:</p>
  
  <pre><code>const Child = () =&gt; {
     const [users, setUsers] = useState([])
    useEffect(() =&gt; {
      setUsers(props.users)
    }, [[...props.users]]);
  }
  </code></pre>
  
  <p>If I for any reason try to access state (users) from either my child or parent components I get my initial value, which is an empty array, not my updated value from getUsers(), generally with a Parent Class component I'd have no trouble accessing that info, but it seems like functional components behave diffently? or is it caused by the useEffect? generally I'd use a class component for the parent but some libraries I use rely on Hooks, so I'm kind of forced to use functional components.</p>