Community JavaScript Snippet

The HOC + Render Props Patterns I Still Read in Legacy Repos

Hooks made HOCs and render props optional, but pre-2019 codebases still ship them. Four patterns to recognize when you inherit a Redux-era React app.

The HOC + Render Props Patterns I Still Read in Legacy Repos

Hooks made HOCs and render props optional, but pre-2019 codebases still ship them. Four patterns to recognize when you inherit a Redux-era React app.

JavaScript
Frontend
4 snippets
react
higher-order-functions
design-patterns
references
diyahassan

By @diyahassan

March 7, 2026

·

Updated May 20, 2026

808 views

20

4.2 (11)

The contract is what makes HOCs unfamiliar to anyone who started on hooks. The HOC owns a slice of state, the wrapped component receives that state as props, and the wrapped component never knows the state lives somewhere else. The two practical wins were that the consumer stayed a pure render function and that you could compose multiple HOCs onto the same component, which is how compose(withRouter, connect(mapState, mapDispatch))(MyView) came to be the canonical Redux + react-router-v4 wrapping. The cost is that the wrapper hierarchy shows up in React DevTools as WithCounter(ClickCounter), debugging stack traces get noisy, and prop collisions (HOC overwriting a prop the consumer already had) are silent unless you go out of your way to detect them. Hooks did away with both costs.