Skip to content
React·Advanced·Output based·1 min read

Why might a higher-order component (HOC) be considered legacy compared to a custom hook for sharing logic?

Short interview answer

An HOC wraps a component in another component layer and can create prop naming collisions or obscure the component tree in dev tools; a hook shares the same logic without adding a wrapper component or any indirection in the rendered tree.

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Component composition patterns

Related questions