useQuery follows the rules of hooks. You can wrap it in a custom hook for convenience if you want to layer in some additional functionality.
useQuery