data fetching, loading state, loading skeletons

Hello currently inside my T3 app I fetch the data from external api on the backend and then pass query it inside Homepage.
const { data: recentData } = trpc.recent.getRecent.useQuery();
const { data: trendingData } = trpc.trending.getTrending.useQuery();
const { data: recentData } = trpc.recent.getRecent.useQuery();
const { data: trendingData } = trpc.trending.getTrending.useQuery();
something like that. Then If there is no data, the user sees a loader. Is this the correct approach or should I instead query the data inside specific components that need it? Also most of websites seems to be using the loading skeletons of individual components instead of loaders (spinning circle in my case). Is there a pattern I can follow to build stuff like that.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server