hoc-compose
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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)));

Readme

Keywords

none

Package Sidebar

Install

npm i hoc-compose

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

2.44 kB

Total Files

5

Last publish

Collaborators

  • andygock