with-hocs
v1.0.0
Published
A higher-order component that compose other higher-order components
Downloads
3
Maintainers
Readme
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!