How to fire a mutation from another component? #8057
Unanswered
shinobu-uwu
asked this question in
Q&A
Replies: 1 comment 1 reply
-
It's best to define things where you actually need them. Why would you want it in a parent that doesn't need it? It's like defining state in the root component. Yes you can use context or prop drilling to pass it down but as you said, that's not a very good solution. |
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
-
Hello
I have one parent component that is where data fetching happens, with
useQuery
, what I'd like to do is: define a mutation in that component, and fire it from a child. I've tried to useuseMutationState
and select themutation.execute
field, butuseMutationState
always returns an empty array, even with a key set and it being the only filter.Also, I'm not using the mutation in my parent component at all, I'd just like to define it there and the children are the one to fire said mutation, prop drilling works, but it's not a very good solution
Beta Was this translation helpful? Give feedback.
All reactions