react-hoc
a higher order component creator helper
reactHOC :: (Enhancer, enhancerDisplayName) => Enhancer
hoc is a higher order enhancer : it take one enhancer and return one enhancer.
it does 3 things :
- hoist non react statics
- hoist/set WrappedComponent property
- hoist/set displayName property
Installation
npm install --save react-hoc
Usage
example with a very basic hoc :
;; ; const withColor = ;const withBlue = ;const BlueComponent = ;BlueComponentdisplayName // => "blue(Dummy)"
if reactHOC
enhancerDisplayName parameter is missing, Hoc()
will be used.
const noColor = ;const Test = ;TestdisplayName // => "Hoc(Dummy)"