Higher Order Components
A HOC wraps a component and returns an enhanced one.
Example
function withLog(C) {
return function Wrapped(props) {
console.log("render", C.name);
return <C {...props} />;
};
}
const LoggedButton = withLog(Button);Exercise
Wraps and returns.
A HOC returns a Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.