-
Notifications
You must be signed in to change notification settings - Fork 8
Store
Woojin Shin edited this page Jan 12, 2021
·
7 revisions
-
Store
- ๋จ์ผ ์คํ ์ด ํํ๋ก ์ํ์ ์ง๊ฐ ํ์ํ ๋ฐ์ดํฐ๋ก state๋ฅผ ์ ์ํ์ฌ ์ ์ง
- Store๋ state์ state๋ฅผ immutableํ๊ฒ ๋ณ๊ฒฝํด์ฃผ๋ ํจ์๋ก ๊ตฌ์ฑ
- Controller๋ฅผ ํตํด ๋น์ฆ๋์ค ๋ก์ง ์ํ ๊ณผ์ ์์ state ๋ณ๊ฒฝํจ์๊ฐ ํธ์ถ๋๋ ๋ฐฉ์
- Store์ ํน์ state๊ฐ์ด ์ ๋ฐ์ดํธ๋๋ฉด StoreEventChannel์ ํน์ ์ฑ๋์ ํด๋น state ๊ฐ์ publish!
-
View
- Component(์ปค์คํ ์จ๋ฆฌ๋จผํธ), ๋ ๋๋งํ์ฌ View๋ฅผ ๋ณด์ฌ์ฃผ๋ ์ญํ ๋ง ๋ด๋น
- Store์ ํน์ state๊ฐ์ ๋ฐ๋ผ ๋ ๋๋ง์ด ํ์ํ๋ค๋ฉด ํด๋น state ๊ฐ์ด publish๋๋ ์ฑ๋์ StoreEventChannel์ ํตํด subscribe!
-
StoreEventChannel
- View - Store๊ฐ์ ์ค๊ฐ๊ณ์ธต
- View์ Store๊ฐ ๊ฒฐํฉ๋ ๋ฏ์ถ๊ณ , Store์ ์ฌ๋ฌ state๋ฅผ ์ ํ์ ์ผ๋ก view๊ฐ ์ ๋ฐ์ดํธ ๋ฐ์ ์ ์๊ธฐ ์ํ ๊ตฌ์กฐ
- ๋ด๋ถ๊ตฌ์กฐ๋ ์ต์ ๋ฒ ํจํด์ผ๋ก ํน์ ์ฑ๋์ ๋ํ View์ ์ต์ ๋ฒ(callback, binding object)๋ฅผ ์ ์งํ๋๋ฐฉ์
- View์์ StoreEventChannel์ ํตํด ์ ํ์ ์ผ๋ก ํ์ํ state๊ฐ์ ๋ฐ๋ผ ํน์ ์ฑ๋์ subscribe ๊ฐ๋ฅ
- Store์์ ํน์ ์ฑ๋์ publishํ๋ฉด ํด๋น ์ฑ๋์ subscribeํ ์ต์ ๋ฒ์๊ฒ notify (์ต์ ๋ฒ์ callback ํจ์๋ฅผ ์คํ์์ผ์ค)
-
Controller
- Component๋ฅผ view๋ฅผ ๋ ๋๋งํ๋ ์ญํ ๋ง ๊ฐ์ง ์ ์๋๋ก ๋น์ฆ๋์ค ๋ก์ง์ ๋ถ๋ฆฌํ ๊ณ์ธต
- ๋น์ฆ๋์ค ๋ก์ง ์คํ ๋์ค, Store์ state ๊ฐ์ ์ ๋ฐ์ดํธ๊ฐ ํ์ํ ๊ฒฝ์ฐ ์ ๋ฐ์ดํธ
- ๋น์ฆ๋์ค ๋ก์ง์ Store์ ๊ฐ์ด ๋ณ๊ฒฝ๋๋ ๋ก์ง์ผ ์๋ ์๊ณ , ์๋ ์๋ ์๋ค
๐ Week1 Meeting Log
๐ Week2 Meeting Log
๐ Week3 Meeting Log
๐ Week4 Meeting Log
๐ Week5 Meeting Log
๐ References
- Official Docs
- Blogs