@kennylavender/next-compose-hocs
v1.0.2
Published
Higher Order Component composition helper for next
Downloads
6
Readme
next-compose-hocs
Higher Order Component composition helper for next.
Dont Use
Turns out this breaks associativity. I have yet to come up with a way to fix.
Use it
Simply import your other HOCs and pass them to nextComposeHOCs
. nextComposeHOCs
will return a new HOC, the new HOC will have a new getInitialProps
property that is composed of passed in HOCs getInitialProps
properties.
import nextComposeHOCs from '@kennylavender/next-compose-hocs'
import withEnv from './with-env'
import withContentPageLayout from './with-content-page-layout'
import withRedux from './with-redux'
import withFeatureToggles from './with-feature-toggles'
import requiresPermission from './requires-permission'
const contentPage = composeHOCs(
withEnv,
withRedux,
withLayout,
withFeatureToggles,
requiresPermission('admin')
)
export default contentPage;