with-hocs

1.0.0 • Public • Published

with-hocs

function Sample(props) {
  return <h1>HELLO {props.capitalized}!</h1>;
}
 
// pass high-order components via hocs props
const Enhance = withHOCs({ importAs: 'hocs' })(Sample);
 
...
 
const hocs = [
  defaultProps({
    name: 'World',
  }),
 
  withPropsOnChange(['name'], ({ name }) => ({
    capitalized: name.toUpperCase(),
  })),
];
 
// <Enhance hocs={hocs} name="sydney" /> → HELLO SYDNEY!
 

Package Sidebar

Install

npm i with-hocs

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

8.84 kB

Total Files

8

Last publish

Collaborators

  • bluewings