Add ability for container components to register their own mapStateToProps function.
This commit is contained in:
@@ -20,8 +20,11 @@ const RootWrapper = (reduxStore, ComponentToWrap) => class extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const makeContainer = (getSystem, component, reduxStore) => {
|
const makeContainer = (getSystem, component, reduxStore) => {
|
||||||
|
const mapStateToProps = component.prototype.constructor.mapStateToProps || function(state) {
|
||||||
|
return {state}
|
||||||
|
}
|
||||||
let wrappedWithSystem = SystemWrapper(getSystem, component, reduxStore)
|
let wrappedWithSystem = SystemWrapper(getSystem, component, reduxStore)
|
||||||
let connected = connect(state => ({state}))(wrappedWithSystem)
|
let connected = connect( mapStateToProps )(wrappedWithSystem)
|
||||||
if(reduxStore)
|
if(reduxStore)
|
||||||
return RootWrapper(reduxStore, connected)
|
return RootWrapper(reduxStore, connected)
|
||||||
return connected
|
return connected
|
||||||
|
|||||||
Reference in New Issue
Block a user