-
Book Overview & Buying
-
Table Of Contents
React Application Architecture for Production - Second Edition
By :
When a user submits a form, they typically have to wait for the server to respond before seeing their changes. This round trip can take some time depending on the network conditions and the server response time, potentially making the application feel slow. Think about posting a review: we click submit, see a loading spinner, wait for the server, and finally see our review appear. It works, but it sometimes feels sluggish.
Optimistic updates solve this by immediately showing the expected result before the server confirms it. When a user submits a review, we show it right away as if it already succeeded. In most cases, the server confirms the action moments later, and the user never notices the difference. The application feels instant.
The approach has three parts: