TanStackT
TanStack3y ago
4 replies
living-lavender

Get value from query hook or pass via props?

Does anyone have a general guidance of when values should be passed via props vs calling a query hook to get the values? For example, in a dashboard page I call a useUser hook which uses useQuery to return the current user. When a settings component mounts as a child of the dashboard component that also needs the current user value, should I pass the value from the dashboard component to the settings component or should I again call my useUser hook inside of the settings component to get the current user? I am new to using react-query. Any guidance on this general concept would be much appreciated!
Was this page helpful?