The optimistic update happens when you update the UI without waiting for a confirmation from the server.
A common practice is to roll back the UI to a previous state and notify the user once we know the request failed.
Examples
- when clicking the up or downvote arrow on Reddit
- when clicking the star rating