TanStackT
TanStack17mo ago
1 reply
urgent-maroon

Minimizing re-renders caused by queries in the parent component of the application

Current tech stack is Static Nextjs application with a Go API and postgres db.

In the parent component of the codebase I am trying to fix, there is a custom hook which makes an api call which provides information for the entire application I am working on. The hook takes in 9 arguments which have state information. Some of this information also comes from parameters in the URL.

I am trying to mitigate rerenders, as any state change almost anywhere in the app causes cascading rerenders due to the hook. I'm hoping React Query could help, but I'm unsure what my best options are for restructuring this application. I imagine server actions would help, but I'd need a surer direction to go in if I want to restructure the whole application.

I'm wondering if anyone can point me at a direction here.
Was this page helpful?