1. 9
    Handle Form Submission States with RTK Query's isLoading and isSuccess Values
    1m 29s

Handle Form Submission States with RTK Query's isLoading and isSuccess Values

Share this video with your friends

Send Tweet

In this lesson we learn about the isSuccess state that accompanies a successful mutation. We also use the isLoading state from a mutation hook to prevent a user from filling out a form multiple times.

Initially, we display a sent message powered with useState and a setTimeout that gets removed after 2s. In this lesson we display the message after our query's isSuccess value returns true. We also rely on the combination of isLoading || isSuccess to prevent additional form submissions.