1. 25
    Optimistically Create Deposits with useOptimistic (experimental)
    3m 22s

Optimistically Create Deposits with useOptimistic (experimental)

InstructorBen Patton

Share this video with your friends

Send Tweet

With the experimental_useOptimistic hook we can get optimistic updates to our UI while our mutation completes.

After the mutation completes and the path is revalidated our optimistically added deposit will be replaced with the deposit from the database.

This hook comes with some caveats however, because of it's experimental nature, we need to disable strict mode in React. While this is functionality that will be super useful in the future, it might not be the best idea to start using it right now.