is there a way to find parameters given to useMutation while it is loading? #2328
-
Suppose I have two different buttons for altering some item via component. In this case one button to lock a thread, and another to pin it:
Now, both buttons need to be disabled while item is mutating. But the one that is clicked also need to have spinning animation and a different label ('lock' to 'locking...' , 'pin' to 'pinning...' ). As it is, it is impossible to distinguish from isLoading alone which one is being sent. It would be possible with useState() hook, like so:
This works, but makes mutateAsync less useful, because isLoading becomes useless and we need extra state. Not a big deal, but if it was possible to recieve something in addition to isLoading from mutateAsync hook it would have been better. Something that shows the parameters that are being sent. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I would maybe do two dedicated mutations:
|
Beta Was this translation helpful? Give feedback.
I would maybe do two dedicated mutations: