4 ms·
“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
by zackify 9y 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.
- underwater 9y agoRender props can solve many of those problems without Higher order components.
- hungerstrike 9y agoNo, 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.