XMLHttpRequest is not defined from fetch api

Hi @JalalSordo

I assume this is because the status, when being rendered in your Fragment, it still a promise at that time, which therefore gets rejected by the UI Kit renderer.

Would you mind testing with the following changes:

const fetchStatus = async () => {
  const result =  await fetch("https://jsonplaceholder.typicode.com/todos/1");
  return result.status;
}

const App = () => {
  // new code
  const [status] = useState(async () => await fetchStatus());

  // same as before
  const [count, setCount] = useState(0);
  return ... 
}

Let me know if this fixes it :slight_smile:

1 Like