function* LoadComments(action) {
try {
const result = yield call(LoadCommentsAPI, action.data);
yield put({
type: LOAD_COMMENTS_SUCCESS,
data: {
postId: action.data,
comments: result.data
}
});
} catch (e) {
yield put({
type: LOAD_COMMENTS_FAILURE,
error: e
});
}
}
.
case LOAD_COMMENTS_SUCCESS: {
const postIndex = state.mainPosts.findIndex(
v => v.id === action.data.postId
);
const post = state.mainPosts[postIndex];
const Comments = action.data.comments;
const mainPosts = [...state.mainPosts];
mainPosts[postIndex] = { ...post, Comments };
return {
...state,
mainPosts
};
}
코드에서 Comments 대문자로해줬는데 LoadComments에서는 comments로 소문자 작성해주셨는데 괜찮은가요?
왜 대문자로 작성하셨는지 궁금해요