From the course: React: Server-Side Rendering

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add data for props

Add data for props - React.js Tutorial

From the course: React: Server-Side Rendering

Start my 1-month free trial

Add data for props

- [Instructor] So far we've used stateless components, or functions, but like most applications, we need to populate our application with data, and as with any regular React application, we get the state populated with data, and then pass these as props to our components. Next.js is a bit different in its approach, but conceptually the same as React, let me demonstrate. So the first thing we're going to do is create a folder inside of our pages here, and we're going to call it API, and then what we're going to do is grab a file from the resources inside of the exercise files and drop it inside of the API. So let's go ahead and do that. Go into the exercise files, click on resources, you have the data file here, and then let's open up our application into the pages, API, and then copy that one into that folder, like so. Then you can close all this and then we're going to go back into Visual Studio Code and continue…

Contents