Replies: 1 comment
-
We had it in v3, but removed it in v4 because it wasn't documented and wasn't useful for most people. You can relatively easily implement the behaviour for yourself, as shown in the migration guide: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was working with my team and noticed they were using useMutation inside services, nested in business logic and completely detached from the react lifecycle. They were plucking the 'mutator' object off of the return value, passing it to services, and using it to perform asynchronous mutations (which they said they learned from the docs). In my opinion, this is not a pattern we want devs to get used to. The "useSomething" notation is meant for react hooks, and is named as such to remind people that (normally) they cannot be run outside of a react component. They should be used when they need to be rerun on state changes, not for performing one-off mutations triggered by user interaction. I think it might be wise to push the use of executeMutation for these types of instances.
8 votes ·
Beta Was this translation helpful? Give feedback.
All reactions