HOC vs Custom Hooks

Which to Use

HOCCustom hook
Shareslogic + wrapping UIlogic only
UsagewithAuth(Component)const user = useAuth()
Downsides"wrapper hell", prop name clashes, harder to typeonly in function components
Todaystill used (React.memo, connect(), withRouter in old code)preferred for sharing logic

Note: React.memo is a built-in HOC: memo(Component) returns a component that skips re-renders when props are equal.