Using the same Loading UI for nested pages (optimal use)
Unanswered
Asari posted this in #help-forum
AsariOP
In Next App router, I'll be using the same <LoadingPage /> component for each loading file on several pages. I don't think you can nest it through to other pages in the same way that you do with layout.tsx. Is there any way to optimize this process rather than putting in several loading.tsx files that are exactly the same in each page folder?
gpt-help said there isn't a way, but figured I'd see if anyone has come across any creative optimizations for this
gpt-help said there isn't a way, but figured I'd see if anyone has come across any creative optimizations for this
2 Replies
American Crow
I thought Loading.tsx is just an upper boundary and children fall back to it (if they do not have an own Loading.tsx). Did you test it?
If that is not the case:
Pretty sure loading.ts does nothing else than wrapping your page and children in a
You can always manually do it:
and reuse the Sekelton like that ofc
If that is not the case:
Pretty sure loading.ts does nothing else than wrapping your page and children in a
React.SuspenseYou can always manually do it:
<Suspense fallback={<MyLoadingSekelton>}>
<PostFeed />
</Suspense>and reuse the Sekelton like that ofc
AsariOP
Yeah, actually I may have been mistaken, and Loading.tsx may actually pass down like you said.
Obviously suspense/skeletons are preferred and more personalized for each page, but I was just wondering for the instance of a quick fix.
Obviously suspense/skeletons are preferred and more personalized for each page, but I was just wondering for the instance of a quick fix.