I am trying to use branch to pick one of three HOCs to use. The current API signature for branch only accepts two HOCs. Is it possible to adapt this to compare amongst three, or n HOCs?
Create your own enhancer some kind of
const mySwitch = (fn, hocs0, hocs1, hocs2) =>
branch(
p => fn(p) === 0,
hocs0,
branch(
p => fn(p) === 1,
hocs1,
hocs2
)
);
Or
compose(
branch(test0, hocs0),
branch(test1, hocs1),
branch(p => !test1(p) && !test2(p), hocs2)
)
what you like more
Thanks!
Most helpful comment
Or
what you like more