Skip to content
Discussion options

You must be logged in to vote

Sure, that would be possible in theory, but it just didn't start out that way because of the simplicity of the API. That said, whenever you find yourself using a useQuery(key, fn) more than once, it's suggested to simply create a custom hook for it. This way, there is (just like you described) a single declaration of functionality that can be shared across the whole app. If we made users define queries before usage, it would work, but would essentially be an unnecessary layer at this point with custom hooks.

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by mettjus
Comment options

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

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants