compose merge functions:
const hoc1 = ...; const hoc2 = ...; const enhance = compose(hoc1, hoc2); const Component = enhance(BaseComponent);
The same thing can be done with the following.
const Component = hoc1(hoc2(BaseComponent));
implementation of compose is quite simple.
const compose = funcs => funcs.reduce((p, c) => (...args) => p(c(...args))); // this only works if funcs.length >= 2