티스토리 뷰
리듀서 내부에서 같은 슬라이스의 다른 리듀서 사용하기
// 슬라이스명.caseReducers.리듀서명(인자)
// state를 사용해야한다면 인자로 state를 전달해주어야 함
customSlice.caseReducers.updateInfo(custom, product, true);
리듀서 내부에서 콘솔 출력했는데 proxy로 나오는 경우, current로 감싸서 확인하기
import { current } from '@reduxjs/toolkit';
...
reducers: {
updateInfo: (state, action) => {
console.log(current('내용'))
},
}
* 참고
2023.04.19
'Javascript' 카테고리의 다른 글
[React] Recoil (0) | 2023.04.21 |
---|---|
[React] React-query (0) | 2023.04.20 |
[React] stopPropagation, preventDefault (0) | 2023.04.19 |
[React] Github Pages로 배포하기(+난독화, 에러처리) (0) | 2023.04.19 |
[React] 이미지 파일 브라우저에서 띄우기 (0) | 2023.04.17 |
댓글
공지사항