04

Update once. Every view agrees. Only readers re-render.

The first post is on screen three times, through three different components. Like it from any of them: the mutation writes one Post record, and Relay notifies exactly the components whose fragments read the fields that changed. The render counters show it. Titles never re-render on a like.
Fetching with Relay…
  • why it mattersNo prop drilling, no global state, no refetch. The mutation response has the same shape as the store, so Relay merges it and every subscriber sees it.
  • why it mattersOptimistic responses make the UI feel instant at any latency. Turn on server failure and Relay reverts the optimistic layer on its own.
  • why it mattersSubscriptions are per fragment, not per query. A like re-renders the LikeButtons and the widget, not the list or the titles.