TanStackT
TanStack3y ago
1 reply
unlikely-moccasin

TS best practice with `enabled` prop

Hi guys, basically I have an custom useQuery hook with an underlying queryFn that requires certain arguments. Now TS yells at me, because the type checker doesn't know that the query won't get enabled/executed until isValid=true . How do you guys handle this situation?

I'd love to hear your opinion on this approach.
CleanShot_2023-08-29_at_15.36.522x.png
Was this page helpful?