pass only non observable props to wrapped component

This commit is contained in:
Richard Ramos 2019-08-27 21:29:44 -04:00
parent 52695e5538
commit 1b662fd574
1 changed files with 9 additions and 1 deletions

View File

@ -55,7 +55,15 @@ function observe(WrappedComponent) {
}
render() {
return <WrappedComponent {...this.props} {...this.state.observedValues} />;
const props = Object.keys(this.props).reduce((accum, curr) => {
if(!isObservable(this.props[curr])){
accum[curr] = this.props[curr];
return accum;
}
return accum;
}, {});
return <WrappedComponent {...props} {...this.state.observedValues} />;
}
};
}