Problem Statement
What are Higher-Order Components (HOCs)?
Explanation
A Higher-Order Component is a function that takes a component and returns a new component with extra functionality. It’s often used for cross-cutting concerns like logging or authentication.
Code Solution
SolutionRead Only
function withLogger(Wrapped) {
return function(props) {
console.log('Props:', props);
return <Wrapped {...props} />;
};
}