3 ms·
Recompose is not really compatible with TypeScript (no clue about Flow). Render props are a good alternative but the nesting made composing a bit cumbersome. Ho
by renke1 8y ago
Recompose is not really compatible with TypeScript (no clue about Flow). Render props are a good alternative but the nesting made composing a bit cumbersome. Hooks are easy to type and compose quite fine it seems.
- baddox 8y agoI 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...