Next.js Discord

Discord Forum

How does loading.tsx work?

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
I have a route
app/(marketing)/[slug]/page.tsx  + loading.tsx
-> this purpose is to provide skeleton for a dynamic page from our CMS
since I know that there are pages that are not entirely dynamic meaning they are set in stone, but the way we architecture it is that they are also composable in our CMS, I created another loading.tsx file under those specific route. For example, we have an about-us page, what I did was let the
app/(marketing)/[slug]/page.tsx
handle the rendering of the page itself
and added loading.tsx under
app/about-us/loading.tsx
like that since I know that's the route, but it doesn't use the about-us loader but instead is using the marketing dynamic route loader instead. How should I fix this?

3 Replies