Hey Serhii, I understand the concern and ultimately I’ve not continued with my usage of withHooks, but I do think it has some appeal from a theoretical standpoint. I tried it experimentally and felt that in practice the extra boilerplate outweighed the value. The problem with the composition of many HOCs is that yes, the component tree gets unnecessarily nested. With withHooks, each component would only ever have one HOC, which would connect all of the hooks to the presentation layer, so nesting is a nonissue. Though hooks are a pseudo-replacement for HOCs, they’re not a complete replacement. For example you can’t achieve render bailouts with hooks. Once a render has begun, you can’t cancel it. The other major problem when using hooks is that components become explicitly dependent on the hooks they consume. However with a mapping layer to pass logic through props, this dependency on the logic provider can be removed from the component, making the component more flexible. I wrote about this in detail in this GitHub issue if you’d care to read further https://github.com/streamich/react-use/issues/597

Software Engineer at Scenery

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store