Start here. This is the direct spoken answer to practice first.
Why this question matters
Optimistic UI is not just a frontend trick. It changes how users perceive authority, errors, and conflicts, so the API and UI need to agree on recovery.
I would use optimistic UI for low-risk, easily reversible actions such as toggling a favorite, marking read, or changing a local preference. The UI updates immediately, sends the mutation, and rolls back or reconciles if the server rejects it. I would wait for server confirmation for payments, permissions, destructive actions, limited inventory, or anything where showing success before confirmation can mislead the user.