Skip to content
Discussion options

You must be logged in to vote

Hooks rules are respected (no conditional or dynamic hook calls)

your user-land implementation also violates the rules of hooks. If the passed-in mutations are a dynamic array, it will error at runtime.

I don’t think this is worth pursuing because the prime use-case for useQueries is to have dynamic queries (e.g. mapping over all users returned from one endpoint and making a request for each of them), and mutations just don’t have that use-case. You would also create a mutationObserver for each call to useMutation even if you only need one of them.

Also, I don’t usually see the problem with multiple useMutation calls in the same component. That usually means you have one “stateful” comp…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ayden94
Comment options

Answer selected by ayden94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants