Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Commit

Permalink
resolves #13
Browse files Browse the repository at this point in the history
  • Loading branch information
quisido committed Nov 10, 2018
1 parent 9cafc90 commit 689e189
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/helpers/with-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ hoc(MyComponent);
*/

module.exports = function withGlobal(getGlobal) {
module.exports = function withGlobal(getGlobal = global => global, setGlobal = () => null) {
return function ReactNWithGlobal(Component) {
return class ReactNComponent extends ReactNPureComponent {

Expand All @@ -26,7 +26,8 @@ module.exports = function withGlobal(getGlobal) {
return createElement(
Component, {
...this.props,
...getGlobal(this.global, this.props)
...getGlobal(this.global, this.props),
...setGlobal(this.setGlobal, this.props)
}
);
}
Expand Down

0 comments on commit 689e189

Please sign in to comment.