← React Intermediate Questions - Set 5 Q45
What are Higher-Order Components (HOCs) in React?
React Intermediate Questions - Set 5
Example
1
const withAuth = (C) => (props) => isLogged() ? <C {...props} /> : <Login />;
What to notice
- Component-to-component function; mostly replaced by hooks and wrapper components.
← Back to the question list