1.0.2 • Published 5 years ago

@kennylavender/next-compose-hocs v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

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

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago