ReactQuestion 09 of 28
What are higher order components?
Answer out loud or in your head first, then compare.
Answer
A Higher Order Component is a function:
Component
↓
HOC
↓
Enhanced ComponentExample:
JavaScript
const ProtectedPage =
withAuth(Page);Historically used for:
- auth,
- permissions,
- subscriptions,
- shared logic.
Today many of these use cases are handled with custom hooks.
How did it go? Be honest — “Not yet” puts the question on your review list.