3 ms·
I don't know much about TypeScript, but is any React HOC function composition compatible with it? It seems like it would be difficult for TypeScript to typechec
by baddox 8y ago
I don't know much about TypeScript, but is any React HOC function composition compatible with it? It seems like it would be difficult for TypeScript to typecheck a compose function where you can do compose(hoc1, hoc2, hoc3), where each HOC renders a child component with some props added.
- renke1 8y agoYou can write HoC with working typings [1]. As far as I know the compose function is harder to type because of the varargs it uses (although I heard recent TS versions can actually handle that). [1]: https://medium.com/@jrwebdev/react-higher-order-component-patterns-in-typescript-42278f7590fb https://medium.com/@jrwebdev/react-higher-order-component-pa...