Re:React Docs Beta – rewritten with hooks and interactive ex...
by imbnwa on Monday October 25, 2021 @01:13PM
(#28990392)
> Edit: The other nice things about hooks is their composability (and this is in fact related to what I said above). With class components, a component can have one state object, so it's hard to compose with other "mixin" type behaviors that need their own dedicated state. You ended up with weird patterns like higher order components (à la Redux withStore) that have basically ceased to exist with hooks (replaced by a useStore hook which can opaquely manage its own state under the hood).
This is more because the React team didn't care to figure out proper mixins beyond "Object.assign all the things"[0]
This is more because the React team didn't care to figure out proper mixins beyond "Object.assign all the things"[0]
[0]http://raganwald.com/2016/07/20/prefer-composition-to-inheri...