AI

Users expect instant feedback. Optimistic UI updates the interface immediately while the server request processes, reverting only if it fails.

Your Task:

  • Implement an optimistic 'Like' button
  • When clicked, immediately increment the likes count locally
  • Then call api.likePost()
  • If api.likePost() throws an error, revert the count back to its original value
TypeScript Solution
Loading...

Submit your code to see test results