title: TypeError: func.apply is not a function
body: <p>I'm trying to use useEffect function like that:</p>
  <pre><code>    const [data, setData] = useState({ courses: [] });
      
      useEffect(async () =&gt; {
          const result = await axios.get(
              &quot;http://example.com/api/v1/categories/&quot;
          );
      
          await setData(result.data);
      }, []);
      
      console.log(data);
  
  return (
      &lt;div&gt;
          &lt;div&gt;{data.info1}&lt;/div&gt;
          &lt;div&gt;{data.info2}&lt;/div&gt;
          &lt;div&gt;{data.info3}&lt;/div&gt;
          &lt;div&gt;{data.info4}&lt;/div&gt;
      &lt;/div&gt;
  );
  </code></pre>
  <p>But when I try to use <code>data</code> variable it sometimes throws this error:</p>
  <pre><code>TypeError: func.apply is not a function
  HTMLUnknownElement.callCallback
  C:/asdasd/node_modules/react-dom/cjs/react-dom.development.js:188
    185 |     window.event = windowEvent;
    186 |   }
    187 | 
  &gt; 188 |   func.apply(context, funcArgs);
        | ^  189 |   didError = false;
    190 | } // Create a global error event handler. We use this to capture the value
    191 | // that was thrown. It's possible that this error handler will fire more
  </code></pre>
  <p>I don't know, where do I miss.</p>