immer라는 걸 이용해서 무결성을 쉽게 유지시켜주는 고마운 라이브러리
produce(state, draft) <== 이런 구조로 호출한다.
예시) 상세 내용 코드펜 참조
const nextState = produce(state, draft => {
const post = draft.posts.find(post => post.id === 1);
post.comments.push({
id: 3,
text: '와 정말 쉽다!'
});
});
produce(state, draft) 에서
state가 복사 할 값,
draft가 복사 한 값 인 거 같다.