title: Cannot fetch JSON data using GET method: resJSON is not defined error
body: <p>I'm trying to get data from backend server usin this fetch function:</p>
  <pre><code> let users = []
    const fetchUsers = () =&gt; {
      fetch(baseUrl + &quot;/users/&quot;, {
        method: &quot;GET&quot;,
      })
        .then((res) =&gt; res.json())
        .then((data) =&gt; (resJSON = data))
        .then((resJSON) =&gt; {
            users = resJSON;
        })
        .catch((err) =&gt; {
          console.log(&quot;error in json&quot;, err);
          users = [];
  
        });
    };
  </code></pre>
  <p>But I get</p>
  <pre><code>error in json ReferenceError: resJSON is not defined
  </code></pre>
  <p>error happens in this line: <code>.then((data) =&gt; (resJSON = data))</code></p>
  <p>The wierd thing is that I see in the backend that the json is created. Also I'm using very similar fetch request for POST data on another endpoint without any issues. So I'm wondering what could be wrong here?</p>