-
It seems Argument of type '{ enabled: boolean; }' is not assignable to parameter of type 'FetchQueryOptions<unknown, unknown, unknown>'.
Object literal may only specify known properties, and 'enabled' does not exist in type 'FetchQueryOptions<unknown, unknown, unknown>'.ts(2345) Sample prefetch code ...
const isSinglePost = ...
await queryClient.prefetchQuery(
[CREATORS_QUERIES.getPosts, { creator }],
() => {
console.log("hello");
//return;
},
{
enabled: isSinglePost,
},
); i'm using version 3.5.11 |
Beta Was this translation helpful? Give feedback.
Answered by
TkDodo
Jan 7, 2021
Replies: 1 comment 3 replies
-
So, there is no enabled option on prefetchQuery. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
waptik
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
prefetchQuery
is a side-effectful method that should not be called during render. If you call it in an effect or in an event handler or something like that, you can just add an if statement around it and not call it at all.So, there is no enabled option on prefetchQuery.