Best practice for selecting a value from a useQuery that returns array
I have a query that returns an array of groups called
useGroups
I am currently doing this
Typescript doesn't like the select since it isn't returning the same type.
Is it better to just use a useMemo
?
Or should I just create another query altogether and go straight to the database again. This isn't a big issue since the database is actually a local sqlite so no network requests are being made.2 Replies
constant-blue•2y ago
select is right but you need a type parameter on useGroups
https://x.com/tkdodo/status/1657026702512467970
sensitive-blueOP•2y ago
awesome thanks very much back so quick !