•
every context consumer re-renders on any change to the value, so widely-shared state with many independent readers wants selector subscriptions instead
•
one centralized store read through selectors, versus many small independent atoms; both avoid re-rendering unrelated readers, by opposite means
•
describing an update as a plain serializable action applied by a pure reducer is what makes a store's history inspectable, replayable and testable
•
subscribing a component to the slice it actually reads, so an unrelated change to the store does not re-render it
•
the reducer stays pure, so async work sits in middleware around the dispatch rather than inside the update
•
data a server owns can change without you, so locally it is a cache and not state, which makes freshness and invalidation first-class concerns
•
loading, error, empty and data are four distinct states a screen renders, and hand-rolling them per component is the boilerplate a query library removes
•
a key identifies a cached request, dedupes concurrent callers of it, and is what you invalidate once a mutation has changed the underlying data
•
serve the cached value immediately, refetch in the background, and swap the fresh one in when it arrives
•
a tab left open goes stale, so returning to it and regaining connectivity are the moments worth revalidating on
•
how long a value counts as fresh is a different window from how long an unused entry is kept before eviction, and confusing them produces either stale reads or constant refetching
•
patching the cached value directly versus marking it stale and letting the next read refetch it
•
apply the expected value, keep a snapshot, restore it on failure, and cancel any in-flight read that could land on top of it
•
a read that needs another's result is DISABLED until its input exists, rather than chained through an Effect
•
keeping the previous page visible while the next loads, and accumulating pages for a load-more list
•
fetching before the component that needs it renders, so the read is a hit rather than a request
•
reusing the references of unchanged parts of a refetched result, so memoized consumers are not re-rendered by identical data