Open atomanyih opened 7 years ago
True for this. Converting code is not as simple as replace compose
with assemble
This doesn't work for example:
assemble(
connect(), // react-redux/connect
withHandlers({
requestSubmit: ({ form, dispatch }) => () => {
dispatch(submit(form)); // ERR: dispatch is `undefined`
},
}),
),
The correct working way would be:
compose( // recompose/compose
connect(), // react-redux/connect
assemble( // reassemble/assemble
withHandlers({
requestSubmit: ({ form, dispatch }) => () => {
dispatch(submit(form));
},
}),
),
);
recompose
'scompose
allows you to compose any HoC (or function for that matter)Transitioning from recompose to reassemble is actually more complicated because of this
If you have code that looks like this in
recompose
It's reasonable to expect this to work in
reassemble
Instead you have write this:
I think that
assemble
shouldn't be aliased ascompose
— it's nice in theory but is problematic if you're transitioning from a codebase withrecompose
and a lot of custom HoCIt's also not clear at first glance why it is failing; in our case it throws up some
propType
errors and doesn't render properly. It would be easier to understand if it could throw an error or print a warning if you pass a non-composable toassemble
btw thanks for making this library! I love
recompose
, but the devtool ballooning problem has kept me from using it more extensively. I've already converted a number of HoC in our codebase to usereassemble