UNPKG

@shopify/react-compose

Version:

Cleanly compose multiple component enhancers together with minimal fuss

11 lines (8 loc) 369 B
import hoistStatics from 'hoist-non-react-statics'; function compose(...wrappingFunctions) { return function wrapComponent(OriginalComponent) { const result = wrappingFunctions.reduceRight((component, wrappingFunction) => wrappingFunction(component), OriginalComponent); return hoistStatics(result, OriginalComponent); }; } export { compose as default };