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.
Properties client component refactor - Next.js Tutorial
From the course: Next.js 14 from Scratch: Build a Real-World Project Using Next.js 14 and MongoDB
Properties client component refactor
So I want to get ready to add pagination, and we want that on this properties page. However, this is a server rendered page, and we need to do some dynamic stuff. So instead of making the properties page itself client side, let's put all this stuff into a client side component called properties. So first off, let's go to app properties and then page.jsx. And instead of fetching this way on the server-side component, we're going to have a client-side component and just do the regular use effect. So I believe I said back in that video that we'll be changing some of this stuff later on, because that's what happens. You create something a certain way, but then you want to implement a new feature, and you have to change things up, right? It's just part of development. So in components, I'm going to create a new file called properties.jsx, okay, and I'd rather not have the logic of fetching the properties in the main page anyway. As you can tell, I like to split things up into separate…
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.