How do I ONLY call my tRPC queries when a condition is met?
1. You might be looking for
useMutation
- https://tanstack.com/query/v4/docs/reference/useMutation?from=reactQueryV3&original=https://react-query-v3.tanstack.com/reference/useMutation
2. If you're NOT looking for useMutation
, you were probably looking for the enabled
key - https://tanstack.com/query/v4/docs/guides/disabling-queries#lazy-queries
THIS QUESTION IS ASKED A LOT SO I DECIDED TO ANSWER IT AHEAD OF TIMEuseMutation | TanStack Query Docs
const {
data,
Disabling/Pausing Queries | TanStack Query Docs
If you ever want to disable a query from automatically running, you can use the enabled = false option.
When enabled is false:
0 Replies