앞서 #2에서 작성한 기존 코드를 improve 해보겠다. switch, case, default const reducer = (state = 0, action) => { if (action.type === "ADD") { return state + 1; } else if (action.type === "MINUS") { return state - 1; } else { return state; } }; if, else if, else ====> switch, case, default const reducer = (state = 0, action) => { switch (action.type) { case "ADD": return state + 1; case "MINUS": return state - 1; default: return state; } }; redux 공식 문서에서도 switch, case, default 문법 사용을 권장하고 있다. 두 번째, 기존에서는 dispatc...
#2에서
#switch
#state
#redux
#reducer
#javascript
#function
#default
#const
#case
#action
#vanilla
원문링크 : [Redux] Vanilla JavaScript에 Redux 적용하기 (Recap)#3