TLDR Tech / Dev
Creating Query Abstractions
Custom hooks are the wrong way to abstract useQuery, as they lock you into one hook, get messy with TypeScript generics, and can't be used outside components. Instead, use queryOptions to define your key and fetch function once, then spread it into whatever hook you need (useQuery, useSuspenseQuery, etc.) with per-usage options on top.
Read the full story