not found doesnt import root layout
Unanswered
Japanese anchovy posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Japanese anchovyOP
Hello, i am using the app router and i have my folder structure as
And i noticed when i use my custom 404 page it doesnt automaticaly import root layout yet the error page does. Is this a bug?
404
error page
app
- page.tsx
- not-found.tsx
- error.tsx
- layout.tsx
And i noticed when i use my custom 404 page it doesnt automaticaly import root layout yet the error page does. Is this a bug?
404
import ErrorInformation from "@components/404/error-information"
import RootLayout from "./layout"
export default function Page() {
return (
<RootLayout>
<ErrorInformation />
</RootLayout>
)
}
error page
'use client' // Error components must be Client Components
import React, { useEffect } from 'react'
import Button from "@components/ui/button"
import {useRouter} from 'next/navigation'
export default function Error({
error,
reset,
}: {
error: Error & { digest?: string }
reset: () => void
}) {
const router = useRouter()
useEffect(() => {
// Log the error to an error reporting service
console.error(error)
}, [error])
return (
<div>
<ErrorPage/>
</div>
)
}
3 Replies
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Vespid wasp
Same problem here. Seems to be intended but not sure why
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/44415017de6fed2ccd5d44b4b2051ac0.webp?size=256)
joulev
a recent regression that was caused by https://github.com/vercel/next.js/pull/52589 most likely