📚 Creating thin abstractions is easy, until you’re trying to build them on top of functions that heavily rely on generics. Then it can quickly turn into a nightmare. I wrote about the tradeoffs of wrapping useQuery and why type inference makes this trickier than it looks.
Post
tkdodo.euCreating Query AbstractionsBuilding reusable abstractions on top of libraries that rely on type inference can be deceptively difficult, which is why we need better ways to build those abstractions ...
What we are missing is a way to share multiple queries together with the combine function. QueryOptions allows to share the whole singular payload (incl. select) but there is no easy way (type-wise) to achieve the same for multiple queries (incl. combine), which is the single source for custom hooks
incl.selectincl.select
Only half-heartedly to be honest. It was originally part of a refactoring that got scrapped but the first tries showed that it won’t be simple to infer the right types. I’ll take this thread as motivation to look at it again tomorrow though 🚀
0 reposts2 likes
No replies yet.