Opinions

Queries In Hooks or Contexts

The documentation and articles across the web show examples of direct usage of useQuery (for a good reason, it is THE interface after all!).

However, as your codebase scales, your application will benefit from using hooks or contexts. This enables logical abstractions that can enhance your query’s data.

Mutations, derived values, and the data/metadata of the query itself may be provided through a singular interface.

As always, do not prematurely optimize for what does not matter. But, food for thought