Answer the question
In order to leave comments, you need to log in
How to add state to reducer.js?
Hello, in the reducer, when adding a comment to the list of comments, I do this:
case ADD_PRODUCT_COMMENT:
return {
...state,
allComments: [...state.comments.allComments, action.payload],
};
Answer the question
In order to leave comments, you need to log in
case ADD_PRODUCT_COMMENT:
return {
...state,
comments: {
...state.comments,
allComments: [
...state.comments.allComments,
action.payload,
],
},
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question