Reputation: 6829
Last day I was trying to write a wrapper around Redux store but I had to copy and paste some code in order to create the same API. With react I could easily extend my class from React.Component
so I was thinking why developers of Redux have not implemented their store like this?
here is copy of the store code:
https://github.com/reactjs/redux/blob/master/src/createStore.js
Upvotes: 1
Views: 88
Reputation: 534
Because you can use enhancer
s instead, which allow you to compose multiple functions with the store in the particular order you want. Using inheritance would require that all your third party enhancers inherit from each other in the order you need them to.
Upvotes: 2