From the course: Next.js 14 from Scratch: Build a Real-World Project Using Next.js 14 and MongoDB
Unlock this course with a free trial
Join today to access over 25,200 courses taught by industry experts.
Custom not found and loading pages - Next.js Tutorial
From the course: Next.js 14 from Scratch: Build a Real-World Project Using Next.js 14 and MongoDB
Custom not found and loading pages
All right, so in this video, we're going to do two things, two really cool features of Next.js. One, we're going to have a custom 404 or not found page. So if I go to like slash test, which doesn't exist, right now it gives us this black 404 page, but we want to make it our own. And then I also want to create a loading page so that when we navigate around the site, like if I go from home to properties, that split second, I want to show a loader. And we can do that simply by creating a page called loading.jsx. So let's start with the not found. So in the app folder, we just simply create a file called not-found.jsx. And let's create a React component. And we'll call this not found page. And as soon as I save that and we go to slash something that doesn't exist, you can see not found page. Now, I'm going to grab from the theme files the HTML that we need. So if we go to not found.html and go down to the section under the nav, which is this right here, we're going to grab that. And then…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
New project and folder structure6m 13s
-
(Locked)
Layout, homepage, and metadata10m 47s
-
(Locked)
File-based routing7m 16s
-
(Locked)
Server vs. client components and router hooks9m 44s
-
(Locked)
Start on the navbar10m 3s
-
(Locked)
Navbar links, drop-downs, and React icons12m 28s
-
(Locked)
Active links and conditional rendering11m 48s
-
(Locked)
Homepage components15m 45s
-
(Locked)
Properties page7m 26s
-
(Locked)
Property card dynamic data14m 41s
-
(Locked)
Home property listings7m 42s
-
(Locked)
Custom not found and loading pages5m 58s
-
(Locked)
-
-
-
-
-
-
-
-