Avoiding the use of useEffect
#12513
Unanswered
UltraWelfare
asked this question in
Q&A
Replies: 1 comment
-
I'm using TanStack Query for data fetching, so this is how I might do it: const customer = watch('customer');
const customerData = trpc.customers.useQuery({ customer }, { enabled: customer !== "" }); For updating a field when another changes, your best option is probably either to keep the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Since the avoidance of useEffect is becoming more and more common, I was wondering how we can avoid it in these two situations:
For example, I have a use-case where a user selects a customer from a select field. The select field only has the id's and the name's of the user. When the user selects a customer it's supposed to show a card with the customer full information.
What I've been doing is:
Similarly, for updating a field when another changes it's the same code as above with the only change being
setValue
or callingreset
.Is there any other way we can tackle this and avoiding using
useEffect
?Beta Was this translation helpful? Give feedback.
All reactions