Re:A guide to useEffect in React
by thatswrong0 on Monday March 11, 2019 @06:36AM
(#19357915)
I wouldn’t say components are unaware of HoCs.. they are implicitly based on the props they accept.
Re:A guide to useEffect in React
by williamdclt on Monday March 11, 2019 @02:31PM
(#19361488)
Of course, but they don't know if the props come from a HOC or another "normal" component. If you're updating the render() of a component, you don't care where the props come from.
It's not that important TBH, the abstraction is pretty thin
I think you meant "explicit"
I agree with you. I've not been too bothered by typing state and default props, but higher-order-components are almost impossible to type properly (a good typedef doubles the LOC count).
I don't like that hooks don't abstract away the shared behaviour as well as HOCs (the component is unaware of the HOC while it it aware of the hook), but being explicit isn't a bad thing either and it's definitely worth it if it makes typing a non-problem