title: TypeError: destroy is not a function in useEffect caused by async/await
body: <p>My React Native <code>(0.61.5)</code> has a <code>16.9.0</code> React bundled which is not the most current one. In app <code>useEffect</code> returns an error of <code>TypeError: distroy is not a function</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/spFpd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/spFpd.jpg" alt="enter image description here"></a></p>
  
  <p>Here is the <code>useEffect</code> code:</p>
  
  <pre><code>useEffect(async () =&gt; {
      try {
        let url = `${GLOBAL.BASE_URL}/api/events/active?group_id=${encodeURIComponent(group_id)}&amp;_role=${role}&amp;_grpmember_id=${grpmember_id}&amp;_group_id=${encodeURIComponent(group_id)}&amp;_device_id=${encodeURIComponent(device_id)}`;
        let res =  await fetch(url, {
          method: "GET",
            headers: {
            'Accept': 'application/json, text/plain',
            'Content-Type': 'application/json',   
            "x-auth-token": token.password,
            "x-auth-secret": token.username,
          }
        });
        //check secret token 
        let secret = res.headers.get("x-auth-secret");
        let jwttoken = res.headers.get("x-auth-token");
        res = await res.json();
        if (secret &amp;&amp; jwttoken &amp;&amp; (typeof secret !== 'undefined') &amp;&amp; (typeof jwttoken !== 'undefined') &amp;&amp; secret !== null &amp;&amp; jwttoken !== null) {
          if(await helper.updateJwtToken(secret, jwttoken)) {
            setToken({password: jwttoken, username: secret});
            authVal.updateToken(token); //set state token in App.js
          };
        } else if (jwttoken === "route to verfi") {
          navigation.navigate("Verif1", {cell: res.cell, cell_country_code: res.cell_country_code, existing_user:true});      
        };
        //update state
        var ordered_data = eventsByDate(res);
        setActiveEvents(ordered_data);
  
      } catch (err) {
        console.log("Error in event refreshing data ", err);     
      };
    })
  </code></pre>
  
  <p>According to a <a href="https://www.reddit.com/r/reactjs/comments/a0u38o/you_can_now_use_the_useeffect_hook_with_the_async/" rel="nofollow noreferrer">online post</a>, the problem is most likely caused by a couple of <code>async/await</code> in the method. It seems to me that the more recent version of <code>React</code> shall fix this problem. What is the version of react shall I upgrade to? Or there is other work around for this instead of version upgrade. </p>