React query mutations
Hi guys I wrote this custom function in react-query to simplify my code
but when i try to call it inside onsubmit in formik
It throws this error
can you guys correct me if I write this fuction wrong, Thank you
1 Reply
sunny-green•3y ago
have a look at our mutation examples. you call
useMutation
at the top of your component, then invoke the returned .mutate
function in the onSubmit handler. you cannot call hooks conditionally, that's a rule of react