How to check if all the data from multiple components is loaded

If my page consists of multiple components that each use trpc.useQuery inside them, how should I check if all the data from them is ready to go? For example trying to do the loading screen if all the data is not ready inside my index page. To be more clear I have lets say Table and Navbar component and want to load the index page where the nav and table are if all data from them is loaded.
5 Replies
barry
barry3y ago
Request them as high up the tree as possible (on that page).
noctate
noctateOP3y ago
oh yes I've been thinking about that. So just use query in index page and then pass data as props to components?
barry
barry3y ago
Not index, do it on a per page basis. No reason to do unnecessary requests
noctate
noctateOP3y ago
ahh that makes sense thxx
barry
barry3y ago
That way you avoid loading spinner, to a component with 2 components now with loading spinner and etc.
Want results from more Discord servers?
Add your server