TanStackT
TanStack4y ago
52 replies
precious-lavender

Some best practices guidelines and advice with Vue

I've only recently started using this package (not sure if I should call it vue-query or react-query) but I just wanted to know best practices in terms of query keys and data...

1. Should we try to re-use queries from composables? Or should queries be more specific to the component itself?
2. When typing the keys for the query, should the query key expect multiple Ref<> values from the component when the query is created or should my composable return these refs to the component?
3. Is it better to use ref or reactive for query key values?
4. Is there a nice way to store pagination data outside of the query cached data? So that when replacing data in queries, I know everything is just a basic array of data or is there a better way of managing query structure? I haven't gotten to this yet but we use a lot of broadcasting and need to be able to replace individual values within data.
Was this page helpful?