Customizing the 404 Error in NextJS
In the previous tutorial, we saw that
NextJS already has a built-in, nicely styled
404 error page.
However, if desired, we can create our own error page, styling it as we see fit (this is called customization).
To do this, you need to create a file
with the special name not-found.jsx
and place it in the app folder:
export default function NotFound() {
return <>
<h1>Error 404</h1>
<p>
this page is not found
</p>
</>
}
Create a custom
404 error output. Make sure that
in case of an error, your file is served,
and not the one built into NextJS.