A page loads `/api/questions` using `fetch` inside a try/catch block. A 404 response does not enter catch unless JSON parsing also fails. How should HTTP errors be handle
Loading page content…
Real questions. Helpful answers. A little collective wisdom.
A page loads `/api/questions` using `fetch` inside a try/catch block. A 404 response does not enter catch unless JSON parsing also fails. How should HTTP errors be handle
An API client uses `(await response.json()) as Profile`, where `Profile` contains a string username. If the server returns `{ "username": null }`, does TypeScript prevent
A component starts a timer inside `useEffect` with an empty dependency array. In a development build with Strict Mode, setup appears twice. How can it keep only one activ
I noticed that my effect runs twice on the initial render. The dependency array is empty. Is this expected behavior with Strict Mode and how should I handle cleanup?
I’m creating a reusable fetch utility and want the return type to be inferred correctly. How can I handle errors without losing type safety?