Next.js Discord

Discord Forum

Is it possible to have a global (or layout and child routes) loading.tsx component (app directory)?

Unanswered
Lapponian Herder posted this in #help-forum
Open in Discord
Lapponian HerderOP
I have a loading.tsx component in my route layout - but it doesn't work on any child routes - only the route where the layout exists. Shouldn't this also work for child routes of the same layout or am I mistaken?

Otherwise, is there a way to achieve this, or do I need to copy my loading.tsx into each child route (not what I want to do).

Thanks!

1 Reply

Lapponian HerderOP
Actually, I think it does work out of the box like this, it's a bit tempermental on my local though. Shows sometimes, most of the time it doesn't 🤷