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
Request them as high up the tree as possible (on that page).
oh yes I've been thinking about that. So just use query in index page and then pass data as props to components?
Not index, do it on a per page basis.
No reason to do unnecessary requests
ahh that makes sense
thxx
That way you avoid loading spinner, to a component with 2 components now with loading spinner and etc.