Next.js Discord

Discord Forum

`app/page.tsx` is not loading

Answered
jaggi73 posted this in #help-forum
Open in Discord
I have a folder structure as follows
- app
    - layout.tsx
    - page.tsx (client component)
    - directory
        - page.tsx


Next is loading
app/layout.tsx > app/directory/page.tsx

instead of
app/layout.tsx > app/page.tsx > app/directory/page.tsx
Answered by fuma
app/page.tsx shouldn't be loaded when opening /directory, page is not layout
View full answer

12 Replies

What seems to be the issue?
Ive tried clearing cache as well
it is correct, what is your problem?
@fuma it is correct, what is your problem?
the file app/page.tsx is not loading altogether
app/page.tsx shouldn't be loaded when opening /directory, page is not layout
Answer
its skipping directly to app/directory/page.tsx
Have you read the docs? I don't sure what is your definition of "load", but if you are referring to "render", it is an expected behaviour
Ahh, i made a silly mistake
thank you for pointing it out!
@fuma `app/page.tsx` shouldn't be loaded when opening `/directory`, page is not layout
whats the best file to add a root level useEffect call since app/layout.tsx cannot be made 'use client'?
You can have client components in a server component, just create the component and put it into your root layout.