reset isSuccess
#1014
Replies: 2 comments 1 reply
-
The Something like that const [isFormSuccess, setIsFormSuccess] = React.useState(false);
const {isSuccess} = useMutation(...);
// Sync values of `isFormSuccess` and `isSuccess` if `isSuccess` changes
React.useEffect(
() => {setIsFormSuccess(isSuccess)},
[isSuccess]
)
function resetForm() {
setIsFormSuccess(false);
}
....
<button onClick={resetForm}>Reset</button> |
Beta Was this translation helpful? Give feedback.
0 replies
-
you can use the 'reset' that the useMutation provides! just call it whenever you want
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a form where I am using isSuccess in my useMutation hook. When I finish saving the form I display a success message. Then when I would like to edit the form again, then I would like to reset isSuccess to false like in the beginning, display no success message and save the form again. Is there a way to do this? I saw the reset function but it only resets data and error.
Beta Was this translation helpful? Give feedback.
All reactions