INDEPENDENT PERSPECTIVES. INTELLIGENT FUTURES.FOLLOW @THESITIMES ↗
The Super Intelligence Times.
AI · SUPERINTELLIGENCE · ROBOTICS · TECHNOLOGYTHE WORLD, REIMAGINED.
← Technology deskTechnology / ORIGINAL EXPLAINER

Fetch Separates Asking for Data from Using the Answer

A network response needs interpretation, validation and a failure path.

NBN Co fibre optic cable being laid in Tarcutta St in Wagga
NBN Co fibre optic cable being laid in Tarcutta St in Wagga. · Illustrative archive photograph. Bidgee / Wikimedia Commons · CC BY-SA 3.0 au. Resized for display; image rights remain with the credited creator.

The request is asynchronous

The Fetch API lets web applications make network requests and receive responses. The result arrives asynchronously, allowing the page to continue other work. A response includes status and headers as well as a body that may need to be read as text, JSON or another form. Receiving a response is not the same as receiving the data the application expected. A server can answer with an error status or an unexpected content type, and the client must handle those possibilities deliberately. The application should not confuse a completed network exchange with a successful operation at the remote service.

A search box in use

Suppose a reader types a search query and the page requests matching articles. Before the first response arrives, the reader changes the query. If the older result is displayed last, the interface can appear to answer the wrong question. Cancellation or request tracking helps prevent that confusion. The example shows that networking is part of interaction design. Loading indicators, empty results and error states should correspond to the actual request lifecycle rather than be generic decorations added around a fetch call.

Check the contract

Applications should validate what they receive before relying on it. Network failures, invalid JSON and legitimate empty responses are different situations. A useful fallback explains what the reader can do next without exposing unnecessary implementation detail. The browser also enforces security policies around origins and credentials. Fetch provides a capable mechanism for communication, but a dependable feature requires a clear agreement about the request, the response and the user-visible outcome when either side cannot fulfill that agreement.

Sources & further reading

MDN: Fetch API ↗

AI-assisted editorial explainer. Sources are provided for verification.

Suggest a correction ↗

Continue reading

The Small Switch Behind the Digital World ↗

Why Silicon Became a Computing Material ↗

Why a GPU Is More Than a Graphics Chip ↗

Subscribe to the Times ↗

Explore the Times.