Skip to content

Conditional prefetching with usePrefetchQuery #7713

Closed Answered by TkDodo
olivierbeaulieu asked this question in Ideas
Discussion options

You must be logged in to vote

if we add enabled, it wouldn't have the same signature as on useQuery because we can't make it a function because we don't have a query instance yet. I think your case is rare enough to not include it, you can always copy the hooks implementation (it's 3 lines of code) and add an if statement yourself, of create a component that you can render conditionally that calls the hook and returns null.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@olivierbeaulieu
Comment options

@TkDodo
Comment options

@olivierbeaulieu
Comment options

@TkDodo
Comment options

Answer selected by olivierbeaulieu
@olivierbeaulieu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants