3.3.0
Disabling Queries
See changes: feat: support skipToken
To disable queries, now you can pass skipToken
as the option variables
to your custom query. This will prevent the query from being executed.
import { skipToken } from '@tanstack/react-query'
const [name, setName] = useState<string | undefined>()
const result = usePost({
variables: id ? { id: id } : skipToken,
})
// and for useQueries example
const queries = useQueries({
queries: [usePost.getOptions(id ? { id: id } : skipToken)],
})