#layout.tsx without a page.tsx?

27 messages · Page 1 of 1 (latest)

compact karma
#

is is possible to only use layout.tsx as the base page? right now my page.tsx is just rendering null but i was thinking of it works to do it in another way so it looks more clean in the directories?

sturdy craterBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

stark smelt
compact karma
#

its for shallow-routing basicly

#

i dont want any full refresh to happen in that specific url or child-urls

maiden wyvern
#

once its visited

compact karma
#

What i meant is that i dont want the components to re-render, therefore i am placing like nav-bar in my layout.tsx

#

and i dont need anything in my page.tsx

compact karma
#

but back to my original question
"use client" export default function UserPage() { return null }
do i need to have the page.tsx? or is there a workaround to only use the layout.tsx?

upbeat mango
#
  1. your page.tsx should not be clientside. 2. yes ofc
#

page.tsx is essential for the nextjs app router

#

u cant define a route without it, as far as i know

compact karma
#

aha okay

#

i guess i will just keep retuning Null then

#

ye once i remove it i get 404 error

upbeat mango
upbeat mango
#

is your question solved?

compact karma
compact karma
upbeat mango
#

cool

compact karma
#

ty guys for answering

upbeat mango
#

u can mark this as answered :)

#

like this

sturdy craterBOT