3 ms·
if you migrate a TS project with strict mode enabled to Hooks, you will see how much implicit type annotations can be dropped I think you meant "explicit" I a
by williamdclt 8y ago
if you migrate a TS project with strict mode enabled to Hooks, you will see how much implicit type annotations can be dropped
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
- thatswrong0 8y agoI wouldn’t say components are unaware of HoCs.. they are implicitly based on the props they accept.
- williamdclt 8y agoOf 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