📖 Step 5: Design - Advanced UI/UX#429 / 498

Optimistic UI

Optimistic UI

📖One-line summary

A pattern that updates the screen immediately, assuming success, and rolls back if the server request fails.

✨Example

✨

옵티미스틱 UI

Optimistic UI

⚡Vibe coding prompt examples

>_

Write an optimistic Like button with React useOptimistic that increments instantly and reverts if the API fails.

>_

Handle adding to-do items optimistically with TanStack Query's onMutate, onError, and onSettled.

>_

List cases where optimistic UI shouldn't be used (payments, stock deduction) and why.

Try these prompts in your AI coding assistant!