From the course: React: Design Patterns

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Printing props with HOCs

Printing props with HOCs - React.js Tutorial

From the course: React: Design Patterns

Printing props with HOCs

- [Instructor] All right, so now that we know a little bit more about what higher order components are and how they work, let's take a look at a few examples of just really nice useful things that you can do with these higher order components. So the first thing that we're going to take a look at is how to use higher order components to print out the props of a component automatically without having to make any changes to the component itself. And remember that that is one of the key features of these higher order components, is that they let us add functionality to a component without adding functionality to the component. It's a little bit of a paradox there. Let me show you what it looks like. Now, first of all, as with the other sections, I've added this new V project for higher order components just to keep things nice and organized. So what we're going to do is we're going to go into the source directory, and let's just create a component that we can use in order to demonstrate…

Contents