TanStackT
TanStack4mo ago
20 replies
worthy-azure

When to use a utility and when to use a custom hook with select?

I want to know what the best practice is for filtering data. I have a main hook that reaches an endpoint. And every time I need to process specific data, I create a new hook and use the main one, passing it a utility as a parameter. The problem is that the hooks are piling up... And I often end up using them in only one place in my application. Therefore, I'm not sure when I should create a new hook to handle data filtering and when I should use the base hook and pass it a utility to filter from the component
image.png
Was this page helpful?