Firebase Redux - seowonintech/react-native-todo-list GitHub Wiki
- reducer์์ firebase push ํจ์๋ฅผ ์ฌ์ฉํ๋ฉด ์๋จ.
- ์๋ฌ๊ฐ ๋๋๋ฐ ์ด์ ๋ ์์ง ํ์คํ ๋ชจ๋ฆ
- ๋ค๋ฅธ ํจ์๋ฅผ ์ฌ์ฉํ์ ๋๋ ๊ทธ๋ฌํ ์๋ฌ๊ฐ ๋์ค๋์ง ํ์ธํด๋ณผ ํ์๊ฐ ์์
- ํ์์จ ์ฝ๋์์ set์ ์ฌ์ฉํ์์ ๋๋ ์๋ฌ๊ฐ ๋ฐ์ํ์ง ์์(์ด์ฐ๋ ์ผ์ด์ง???)
// You are not supposed to use any functions in reducer??
case actions.ADD_TODO:
// dbRef = state.database.ref();
// console.warn('[KangLOG] action.text : ' + action.text);
// dbRef.push({
// text: action.text,
// complete: false,
// });
return state;์ง๊ธ๊น์ง๋ redux์ ์ ์ฅํ ๋งํ ๋ฐ์ดํฐ๋ TextInput์ Text์ firebase์ database๊ฐ์ฒด๋ฅผ ์ ์ธํ๊ณ ์์๋ค.
ํ์ฌ Add todo๋ฅผ ํ๊ธฐ์ํด์ onPress์ด๋ฒคํธ์์ firebase์ pushํจ์๋ฅผ ์ฌ์ฉํ๋๋ฐ ์ด ๋ถ๋ถ์ middleware๋ฅผ ์ฌ์ฉํ์ฌ ๊ตฌํํด๋ ์ข์ ๊ณต๋ถ๊ฐ ๋ ๋ฏํ๋ค.
It provides a third-party extension point between dispatching an action, and the moment it reaches the reducer.