Files
Jiachi LiuandGitHub 02197bc364 Fix status code for /_not-found route (#64058)
### What

Fix the status code in static generation metadata for `/_not-found`
route, aligning it as 404 for both dev and build

### Why
`/_not-found` route should still return 404 code as it's reserved as
default not found route

Closes NEXT-3001
2024-04-04 17:35:27 +02:00

29 lines
658 B
JavaScript

'use client'
import { useState, Suspense } from 'react'
import { notFound } from 'next/navigation'
import NotFoundTrigger from './not-found-trigger'
export default function Root({ children }) {
const [clicked, setClicked] = useState(false)
if (clicked) {
notFound()
}
return (
<html className="root-layout-html">
<body>
<Suspense fallback={<div>Loading...</div>}>
<NotFoundTrigger />
</Suspense>
<button id="trigger-not-found" onClick={() => setClicked(true)}>
Click to not found
</button>
{children}
</body>
</html>
)
}
export const dynamic = 'force-dynamic'