Grokking React Advanced
Vote

0% completed

​

Optimistic Updates with useOptimistic

Most chat apps show your message in the conversation the moment you press Send, before the server has stored it. If the server later rejects the message, the app removes it or marks it as failed. Showing the expected result of an action before the server confirms it is called an optimistic update, because the interface assumes that the request will succeed.

React 19 provides the useOptimistic hook for this. It holds a temporary version of some state that is shown only while an action is running, and React throws the temporary version away when the action ends.

How the hook works

``

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content