Skip to content
Discussion options

You must be logged in to vote

all you are really missing is to add the query to the queryKey:

https://codesandbox.io/s/react-query-search-forked-t1o496?file=/src/App.js

I've also added keepPreviousData, but that is merely to avoid loading states between filters.

Everything you use in the queryFn should be part of the queryKey. This is documented:

We even have an eslint rule that should catch this:

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@gmcamposano
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@gmcamposano
Comment options

Answer selected by gmcamposano
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants