The traditional flow is request → spinner → response → re-render. Optimistic UI updates the screen the instant the action fires — for high-confidence actions like a like or a checkbox — and rolls back with an error only in the rare failure case.
It's closely tied to the Doherty Threshold: when perceived latency approaches zero, the app *feels* instant. Slack and X's like/reaction buttons are the classic example.
Left waits for a spinner before filling in; right fills in immediately and confirms with the server silently afterward.
When to use
Use it for low-risk, easily reversible actions (like, toggle, add to cart). Avoid it for payments or deletions that are hard to undo.