From the course: React Foundations by Pearson
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Introduction to functional components - React.js Tutorial
From the course: React Foundations by Pearson
Introduction to functional components
Right, well, we're going to get started looking at functional components, but let's just remind ourselves where we've got to so far. So in the previous lesson, where we looked at class-based components, we saw that you can define a class which inherits from React.Component, and your component class overrides the render function to render the user interface for that component. We also saw that a component has a field called this.props, which points to an object properties that are basically passed in to your component to say, here's the data that you should display. So this is the class approach that we've seen in the previous lesson. And here's a reminder of what the code looked like. So I've got an items list class. It inherits from React component, so it's a component class. It implements the render function. So when I create one of these item list components and render it, this function will be invoked. And whatever I return from that function, that's what's going to be displayed…
Contents
-
-
-
-
-
(Locked)
Learning objectives1m 26s
-
(Locked)
Introduction to functional components4m 53s
-
(Locked)
Defining simple functional components6m 59s
-
(Locked)
Creating a more ambitious user interface3m 27s
-
(Locked)
Passing properties to a functional component8m 30s
-
(Locked)
Destructuring properties10m 3s
-
(Locked)
Lab: creating functional components7m 49s
-
(Locked)
Lab solution: Creating functional components7m 39s
-
(Locked)
-
-
-
-
-
-
-
-
-
-