JSPM

hoist-react-statics

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1672
  • Score
    100M100P100Q112257F
  • License MIT

Dont forget to hoist all props from a base component

Package Exports

  • hoist-react-statics

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hoist-react-statics) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

NPM

The problem

How many times you wrap one component by another? Use the React's HOC paradigm?

const MySuperComponentWrapper = props => (
   <AmazingStuff><WrappedComponent {...props} /></AmazingStuff>
)

That about propTypes? types?

The Solution

import hoistReactStatics from 'hoist-react-staticsr';

const MySuperComponentWrapper = hoistReactStatics(props => (
  <AmazingStuff><WrappedComponent {...props} /></AmazingStuff>
), WrappedComponent);

But why?

Are you mad mate? I need only one line to solve this problem! I have written

const MySuperComponentWrapper = props => (
   <AmazingStuff><WrappedComponent {...props} /></AmazingStuff>
)
MySuperComponentWrapper.propTypes = WrappedComponent.propTypes;

But

  • what about Flow/TS types?
    Huh?

Licence

MIT