Replies: 1 comment 1 reply
-
you can pass the mutate function from
|
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a javascript file called helper.js, inside it is a bunch of helper functions.
As you can see above I need to fire a POST request in the helper function
updateDataIfNeeded
inside aif
condition. The problem is that I am not sure how can I take advantage of theuseMutation()
hook to fire the request since the helper.js is neither a React function component nor a custom React Hook function.I wonder what is the best practice to fulfil my need and use
useMutation()
for the POST request in my helper function?Beta Was this translation helpful? Give feedback.
All reactions