我有pages/404.ts以下內容的自定義:
export default function NotFound() {
return <h1>404 - Page Not Found</h1>
}
當某個組織為空時,我還有另一個頁面顯示 404:
import Error from 'next/error'
const Slug: NextPage<SlugProps> = ({ organization }) => {
if (!organization) {
return <Error statusCode={404} />
}
return <h1>{organization.name}</h1>
}
我想 NextJS 顯示我的自定義 404 頁面,而不是顯示默認頁面

我需要做什么才能顯示我的404 頁面?
uj5u.com熱心網友回復:
您正在重用內置錯誤頁面。
如果您想在動態路由中顯示您的自定義 404,只需匯入您的NotFound組件并回傳它。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/340946.html
標籤:javascript 打字稿 下一个.js
上一篇:將字串轉換為盲文
