title: React TypeScript 16.8 How to make useEffect() async
body: <p>Why can't <code>useEffect()</code> use async-await?</p>
  <pre><code>const Home: React.FC = () =&gt; {
      
      useEffect(async () =&gt; {
          console.log(await ecc.randomKey())
      }, [])
      
      return (
      ...
  
  </code></pre>
  <p>The error I get is</p>
  <blockquote>
  <p>Argument of type '() =&gt; Promise' is not assignable to parameter of type 'EffectCallback'.</p>
  </blockquote>
  <blockquote>
  <p>Type 'Promise' is not assignable to type 'void | (() =&gt; void | undefined)'.</p>
  </blockquote>
  <blockquote>
  <p>Type 'Promise' is not assignable to type '() =&gt; void | undefined'.</p>
  </blockquote>
  <blockquote>
  <p>Type 'Promise' provides no match for the signature '(): void | undefined'.ts(2345)</p>
  </blockquote>