Redux’s Mysterious Connect Function
tyler clark
2.3K11

Hmmm, I am using mapStateToProps and bindActionCreators:

const mapStateToProps = (state, ownProps) => {return {
somePropsKey: state.SomePartOfMyStore
}};
const mapDispatchToProps = (dispatch, ownProps) => {
return bindActionCreators({
someActionCreator
}, dispatch)
};

In mapStateToProps, the key(s) defined will be accessible as props to the connected component, i.e. this.props.somePropsKey

The function bindActionCreators does the sam thing for your imported action creators, i.e. this.props.someActionCreator