MODULO Full Stack Web Development: The Ultimate Master SagaTHEORY

Handle an unsuccessful fetch

Write an async function that requests a local JSON file, checks response.ok, and returns the parsed data. Call it once with the right filename and once with a missing filename.

Check your work

The first call should produce the JSON value. An HTTP 404 still gives fetch a Response, so check its status before parsing. Show the status in the error path and restore the loading state after either outcome.