๐ฅ Today
-
[ByteDegree]
typesafe-actions
๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ฌ์ฉ์ผ๋ก ์ก์ ์์ฑํจ์์ reducer์ ๋ ๊น๋ํ๊ฒ ์ฌ์ฉํ ์ ์๊ฒ ํด์คcreateStandardAction
์ผ๋ก as const์ ์ฌ์ฉํ์ง ์๊ณ ๋ ์ค์ ๋ฌธ์์ด ๊ฐ์ ํ์ ์ผ๋ก ์ง์ ํ ์ ์๊ฒ ํด์คcreateReducer
๋ก reducer ์์ฑ. ๋ฉ์๋ ์ฒด์ด๋ ๋ฐฉ์๊ณผ object map ๋ฐฉ์์ด ์๋ค.
object map ๋ฐฉ์
const counter = createReducer<CounterState, CounterAction>(initialState, {
[INCREASE]: (state) => ({ count: state.count + 1 }),
[DECREASE]: (state) => ({ count: state.count - 1 }),
[INCREASE_BY]: (state, action) => ({ count: state.count + action.payload }),
});
๋ฉ์๋ ์ฒด์ด๋ ๋ฐฉ์
const counter = createReducer<CounterState, CounterAction>(initialState)
.handleAction(INCREASE, (state) => ({ count: state.count + 1 }))
.handleAction(DECREASE, (state) => ({ count: state.count - 1 }))
.handleAction(INCREASE_BY, (state, action) => ({
count: state.count + action.payload,
}));
๐ฅ To Do
- [ecommerce-website] โฉ
- [๋ถ์คํธ์ฝ์ค] project B
- [Algorithm]
javaScript
๋งค์ผ 1๋ฌธ์ ์ด์ ํ๊ธฐ - [๋ถ์คํธ์ฝ์ค] CS ์๋ฃ๊ตฌ์กฐ, ์๊ณ ๋ฆฌ์ฆ ๊ฐ์
- [ByteDegree]
React
10์ฃผ์ฐจ - TypeScript & React โฉ- 10์ฃผ์ฐจ Quiz : ~ 02/01