Which style would you favor when informing parent component of mutation completion? #7948
Unanswered
mistyharsh
asked this question in
Q&A
Replies: 1 comment 1 reply
-
the rules of react forbid running side effects (callbacks) during render, so 2) is not good. you want:
|
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
-
I have a component which accepts an
onComplete
prop which is invoked when mutation succeeds:However, I recently experimented with directly calling side-effects inside the component render cycle (of-course protected by sufficient conditions) like following:
Is this a correct model to think about when using
@tanstack/react-query
w.r.t. mutations? Do you foresee any issues with this approach considering some of the components may be used in server-side rendering and in React 18 concurrent mode?Beta Was this translation helpful? Give feedback.
All reactions