Answer the question
In order to leave comments, you need to log in
The specifics of the work of the reducer?
Hey! Let's say we have a reducer:
export const reducer = (state = initialState, action) => {
const result = Object.assign({}, state);
switch (action.type) {
case 'TEST_ACTION':
return result;
default:
return result;
};
};
Answer the question
In order to leave comments, you need to log in
I sketched an example, I did not take out the action separately, I think this will not confuse.
Re-rendering will happen - https://codesandbox.io/s/m43v2pmxj9
(clicking on the button causes console.log 'render')
ps therefore, if it doesn't work for you, then either there was a mistake in the subscription (in mapStateToProps), or somewhere else. Do the same example on codesandbox, we'll figure it out.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question