๋ฆฌ๋์ค ๋ฏธ๋ค์จ์ด
-
โ ์ฐ์ํ ํ ํฌ๋ฌ๋ 3๊ธฐ: React & TypeScript 5ํ์ฐจ์ฐ์ํ ํ ํฌ๋ฌ๋ 3๊ธฐ 2020. 9. 19. 19:03
โ 9์15์ผ (ํ) ์ฐ์ํ ํ ํฌ๋ฌ๋ 3๊ธฐ 5ํ์ฐจ ๊ฐ์ ์ ๋ฆฌ ๐ 5ํ์ฐจ ๊ฐ์ ๋ชฉํ javascript๋ก ๋ง๋ Redux ๋ฆฌ๋ทฐ Redux์ ๋น๋๊ธฐ Redux ๋ฏธ๋ค์จ์ด ์์๋ณด๊ธฐ ๐ป Redux ๋ฆฌ๋ทฐ 2ํ์ฐจ๋ ๋ง๋ ๋ฆฌ๋์ค๋ฅผ ์ฌ์ฉํ์ฌ store์ reducer ์์ฑ ํด์ค๋ค. ์์ธํ ๋ด์ฉ์ ์ ๋งํฌ ์ฐธ์กฐ ๐ index.js import { createStore } from "./redux"; function reducer(state = { counter: 0 }, action) { switch (action.type) { case "inc": return { ...state, counter: state.counter + 1 }; default: return { ...state }; } } const store = ..