From the course: React.js: Building an Interface

Unlock the full course today

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

Passing data to a component

Passing data to a component - React.js Tutorial

From the course: React.js: Building an Interface

Start my 1-month free trial

Passing data to a component

- Components need to do more than just displaying content. So let's take a look at how we can pass information down to a component. And to do that I'm going to create another new component that's going to have sort of the information for each one of these items right here. So, I'm going to make this bigger and I'm going to grab all this code right here and I'm going to put that inside a component. So I'll create a new file right here. I'll call this appointment info and I'll just paste all this right now but I also need to create this component properly. So this will be const appointment info and using the arrow function, we'll use a return statement and that's where all of our code will go. And we need to export as a default the appointment info. We're using the trash icon here so, let's go ahead and go back into our component. And I'm going to copy this line from here but I'll delete this BI trash from here 'cause…

Contents