conditional useQuery without input
How to use the enabled option for useQuery that doesn't has an input?
I'm passing undefined and TS is not complaining, only on runtime I get
app-index.js:33 Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: [["iam","logout"],{"type":"query"}]
How to properly use this feature?4 Replies
a query is enabled by default, so you don't need
enabled: true
I'm a bit late but perhaps you're looking for mutations , not queries. Makes no sense to have a logout as a query.
Queries are data loaders (get data)
Mutations are actions (do something)
I was going to use a mutation, but the mutation is expecting that I pass arguments
Not if you pass undefined just like you did here no?