Return values of the custom hook called from two different components #2039
-
My apologies if this turns out to be a question about React hooks, rather than React Query. I have defined a custom hook
I have two components X and Y that use this hook. Y is a child of X.
When Y calls mutate(), should X see the corresponding results reflected in isError and isLoading? I tested this by throwing error and introducing delay in my API call, but isError and isLoading never become true. Anything I'm doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
No, mutations only track state on a per-instance level. This works for queries though. |
Beta Was this translation helpful? Give feedback.
-
From what I understand you can use useIsMutating for that behavior |
Beta Was this translation helpful? Give feedback.
No, mutations only track state on a per-instance level. This works for queries though.