01
One round trip instead of a waterfall
A screen showing a user, their posts, and each post's comments with commenter avatars. With REST, every level of nesting waits for the one above it, and each comment triggers another request for its author. With GraphQL the client describes the whole tree once and the server resolves it next to the data.
Fetching with Relay…
- why it mattersLatency multiplies with depth on REST: four levels means four sequential round trips before the screen can paint. Push the latency slider up and watch the gap widen.
- why it mattersREST endpoints return whole resources. The GraphQL response contains only the fields the UI selected, so bytes on the wire track what you actually render.
- why it mattersNo hand-written orchestration: no
Promise.all, no dedupe cache, no loading state per level. Relay sends one query and suspends once.