|
|
|
|
|
by hardwaresofton
3007 days ago
|
|
I looked up HOCs not long after writing the comment, and I agree -- this is much better than the mixin approach that used to be the way (though if I remember correctly, mixins were considered 'temporary' at the time). This isn't a benefit of react though -- this is just react incorporating a well known functional paradigm, which I don't mind. IMO If react was simple, this would have been the way to do it from the start -- no mixins detour. This answer would have fallen out (as it now has), if they simply didn't offer a way to inherit functionality, in that manner. If a component is truly just a function from state to output, the obvious way to combine them IS higher order functions. |
|