Hacker News new | ask | show | jobs
by zackify 3007 days ago
“higher order components should be the exception, not the rule.”

This just isn’t true. Abstracting form logic. Request logic. Anything else you use across your app. Connect in redux. There are hundreds of good reasons to have a higher order component.

It makes testing easy. Test your request logic in one place, anything that uses it is now a stateless component, and testing it is trivial.

2 comments

Render props can solve many of those problems without Higher order components.
No, they should still be the exception for the reasons already stated but also because defining all logic in a “render” function means it’s tightly coupled to your view logic, which you do not want.

Request logic doesn’t belong in a render function. Routing definitions don’t belong in a render function and neither does abstract form logic.