Merge pull request #3565 from owenconti/ft/map-state-to-props-for-components

`mapStateToProps` for container components
This commit is contained in:
Kyle
2017-08-21 17:09:00 -07:00
committed by GitHub
2 changed files with 70 additions and 1 deletions

View File

@@ -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