From d9b0632d16d4eb78ed194693ff4ac5340f251241 Mon Sep 17 00:00:00 2001 From: Owen Conti Date: Fri, 11 Aug 2017 16:01:01 -0600 Subject: [PATCH] Add ability for container components to register their own `mapStateToProps` function. --- src/core/plugins/view/root-injects.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/plugins/view/root-injects.js b/src/core/plugins/view/root-injects.js index 1d996102..b916bee3 100644 --- a/src/core/plugins/view/root-injects.js +++ b/src/core/plugins/view/root-injects.js @@ -20,8 +20,11 @@ const RootWrapper = (reduxStore, ComponentToWrap) => class extends Component { } const makeContainer = (getSystem, component, reduxStore) => { + const mapStateToProps = component.prototype.constructor.mapStateToProps || function(state) { + return {state} + } let wrappedWithSystem = SystemWrapper(getSystem, component, reduxStore) - let connected = connect(state => ({state}))(wrappedWithSystem) + let connected = connect( mapStateToProps )(wrappedWithSystem) if(reduxStore) return RootWrapper(reduxStore, connected) return connected