title: I can't change the state in callback axios (I used useEffect, useState, axios)
body: <pre><code>function User() {
      const [user, setUser] = useState({})
  
      useEffect(() =&gt; {
          const user-token = window.localStorage.getItem('user-token');
          const getUser = async () =&gt; {
          if (user-token !== null) {
              const user = await axios.get('http://localhost:5000/api/index/info')
  
              setUser(user.data.info)
              console.log(user.data.info) // server return result is what I expected: {name: "hanh", age: 20}
              console.log(user) // but this is not change, it still {} 
          }
  
          getUser()
      }, []
  }
  </code></pre>