Created
May 31, 2017 10:17
-
-
Save ducdigital/4d8ad435e391d96a65b7873d4ab88133 to your computer and use it in GitHub Desktop.
Simple HOC component with lodash flowRight
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let Component = {}; | |
_.flowRight([ | |
function helpers(extradata) { | |
return function (Component) { | |
console.log('helpers component', Component); | |
Component.helpers = 'passedHelpers'; | |
Component.extradata = extradata; | |
return Component; | |
}; | |
}({a: 'b'}), | |
function translate() { | |
return function (Component) { | |
console.log('translateComponent', Component); | |
Component.translate = 'passedTranslate'; | |
return Component; | |
}; | |
}() | |
])(Component) | |
console.log(Component); | |
// return Object {translate: "passedTranslate", helpers: "passedHelpers", extradata: Object} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment