From the course: React: Design Patterns (2021)
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Higher-order component improvements
From the course: React: Design Patterns (2021)
Higher-order component improvements
- [Instructor] All right, so now that we've seen how to create a withEditableUser higher order component, we're going to take this one step further and create a withEditableResource higher order component. This will be kind of similar to what we did earlier in the course when we created a container component that did the same kind of thing. So, here's what this is going to look like. We're going to start off by creating a new file for this higher order component which we'll call withEditableResource as I said. And we're going to start off by copying and pasting the withEditableUser higher order component. So we're just going to be making this a little bit more generic and reusable. So first of all, let's change the name of this higher order component to withEditableResource. And the next thing we're going to do is change the arguments a little bit. So it's still going to take the component as its first argument, the…