-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
I'd like to have direct replacements for or at least an explanation of how one would emulate every hoc from recompose, as that library is so prevalent
I took a cursory glance at the documentation and came up with this graph:
| emoji | meaning |
|---|---|
| β | covered |
| π§ | feasible, not implemented yet |
| π€ | need to think on it |
| π§ | π§ |
| hoc | explanation | |
|---|---|---|
| β | mapProps() | this is just cc.map(a => b) |
| β | withProps() | this is just CC.of({}) |
| π€ | withPropsOnChange() | |
| π€ | withHandlers() | |
| β | defaultProps() | is just CC.of({}) |
| β | renameProp() | is just cc.map(a => b) |
| β | renameProps() | is just cc.map(a => b) |
| β | flattenProp() | is just cc.map(a => b) |
| β | withState() | |
| π€ | withStateHandlers() | |
| π§ | withReducer() | |
| β | branch() | is just fork() |
| β | renderComponent() | is just fork(true ), maybe could add a special case? |
| β | renderNothing() | is just fork(true, () => null |
| π§ | shouldUpdate() | |
| β | pure() | is just pure() β¦ not sure this is a good one to promote, though? |
| β | onlyUpdateForKeys() | is just pure() |
| π€·ββοΈ | onlyUpdateForPropTypes() | |
| π§ | withContext() | |
| π§ | getContext() | |
| β | lifecycle() | withLifecycle() |
| π§ | toClass() | |
| β | toRenderProps() | |
| β | fromRenderProps() |
For the "handlers" hocs, I think it makes the most sense to just implement something like the useCallback hook, and then they are just different mappings/combinations of that chainable.
Metadata
Metadata
Assignees
Labels
No labels