Tsallaka zuwa abun ciki
Justice Tech School

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

What does a HOC take?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.