3 ms·
With merge props I mean passing down the local state to the next component. If you see the react article I linked it’s the injectedProps. I think this might be
by codeptualize 4y ago
With merge props I mean passing down the local state to the next component. If you see the react article I linked it’s the injectedProps.
I think this might be quite common, if you haven’t experienced HOC hell I can understand the confusion why hooks are necessary.
In terms of putting it in a function: there is only one state object per component, you could pass setState around, but you can imagine what would happen if many functions call it. It’s also a lot more effort on the implementation as you would have to basically pass state, and call do some sort of update in the lifecycle methods. It would probably work for one function, but with many it will get problematic. You would almost have to write your own pseudo hooks framework to make this work in a decent way.