Answer the question
In order to leave comments, you need to log in
How does mapStateToProps work in Redux?
Hello! I am new to Redux. I want to explain the picture on a test example.
There is a "search" reducer with its own state:
var searchState = {
search: { value: '', type: 'ordernumber' }
};
Component_A = connect(function(state) {
return {
type: state.search.type,
}
})(Component_A);
Answer the question
In order to leave comments, you need to log in
mapStateToProps has a check - "Have props changed?": if yes, the component is updated, if not, it is not updated.
In your case, it's possible that something else is causing component A to rerender... please provide more code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question