1.0.2 • Published 5 years ago

hoc-compose v1.0.2

Weekly downloads
13
License
MIT
Repository
github
Last release
5 years ago

Single compose() function, taken from Andrew Clark's recompose library.

const composedHoc = compose(hoc1, hoc2, hoc3)

// Same as
const composedHoc = BaseComponent => hoc1(hoc2(hoc3(BaseComponent)))

Install:

npm i -s hoc-compose

Example usage:

import { compose } from 'hoc-compose'

// ... your code

export default compose(
  withRouter,
  withApi,
  withStyles(styles)
)(MyComponent);

Would be equivalent to exporting with:

export default withRouter(withApi(withStyles(styles)(MyComponent)));