How it works
Most requests succeed, so instead of showing a spinner the app updates the screen immediately and sends the request in the background. If the server rejects it, the app rolls back to the previous state and tells the user. The result feels instant even on slow connections.
React's useOptimistic hook, TanStack Query's onMutate callback and similar tools in other frameworks handle the bookkeeping. It suits likes, list edits, reordering and chat messages; it does not suit payments, bookings or anything where showing success too early would mislead.
Related terms
More in Rendering and architecture
Patterns