dispatch1 [220503] redux ) handleActions, createStore handleActions reducer를 좀 더 간단하게 만들 수 있음 import { handleActions } from 'redux-actions'; const CHANGE_USER = 'user/CHANGE_USER'; /* const reducer = (state = initState, action) => { switch (action.type) { case CHANGE_USER: return { ...state, user: action.user } } } 위 과정을 이렇게 줄여줌 */ const reducer = handleActions({ [CHANGE_USER]: (state, action) => ({ ...state, user: action.user }) }); createStore로 r.. 2022. 5. 9. 이전 1 다음