TanStack Query
enabled
Controls whether a query automatically fetches. Manual refetch is a separate action.
Formal Syntax & Structure
react syntaxreact
enabled: category !== ""Working Example
Example Snippetreact
useQuery({queryKey:["stock",category],queryFn:readStock,enabled:!!category})