How can I call an unknown amount of useMutations or set MutationKey in mutateFn?
I need to set the
mutationKey
for each item so I track the loading status in another component. Correct me if I'm wrong, after reading the docs and some research.
- there is no useMutations
like useQueries
which would allow me to create the useMutationObject and pass in the key for each useMutationObject
- I cannot set the mutationKey
in themutationFn
Thank You! Unfortunately im on v4 for now
My use case is as follows:
2 Replies
national-gold•11mo ago
I think
predicate
can help you here: https://tanstack.com/query/latest/docs/framework/react/guides/filters#mutation-filters
TanStack | High Quality Open-Source Software for Web Developers
Headless, type-safe, powerful utilities for complex workflows like Data Management, Data Visualization, Charts, Tables, and UI Components.

stormy-goldOP•11mo ago
Thank you for replying so quickly. Just made a POC. This would work with my usecase!