@kennylavender/next-compose-hocs

1.0.2 • Public • Published

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;

Readme

Keywords

Package Sidebar

Install

npm i @kennylavender/next-compose-hocs

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

12.6 kB

Total Files

7

Last publish

Collaborators

  • kennylavender