Start here. This is the direct spoken answer to practice first.
Overview
Optimism improves perceived speed only when temporary state can be matched safely to the command that produced it.
useOptimistic displays a temporary state while an Action is pending, then React returns to the authoritative state when the Action settles. I give each pending item or change a stable client identity, mark it as pending, and reconcile it with the server result. A failure removes or marks only the affected optimistic change and gives the user a clear retry path.