mapStateToProps
Learn how to provide the store data to your component.
Accessing parts of the global state with mapStateToProps
mapStateToProps
receives the complete state as a first parameter and the ownProps
of the component as a second parameter. These props might be passed to the HOC. Depending on whether only the first or both parameters are passed, the function is either called if something changes within the Redux state or if the props change, which is passed to the component. It takes the following form:
const mapStateToProps = (state, ownProps) => {
// ...
};
...