Firebase Redux - seowonintech/react-native-todo-list GitHub Wiki

Redux

  • 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;

Firebase & Redux

์ง€๊ธˆ๊นŒ์ง€๋Š” redux์— ์ €์žฅํ• ๋งŒํ•œ ๋ฐ์ดํ„ฐ๋Š” TextInput์˜ Text์™€ firebase์˜ database๊ฐ์ฒด๋ฅผ ์ œ์™ธํ•˜๊ณ  ์—†์—ˆ๋‹ค.

ํ•ด๋ณผ๋งŒํ•œ ์ž‘์—…

ํ˜„์žฌ Add todo๋ฅผ ํ•˜๊ธฐ์œ„ํ•ด์„œ onPress์ด๋ฒคํŠธ์—์„œ firebase์˜ pushํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋Š”๋ฐ ์ด ๋ถ€๋ถ„์„ middleware๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ตฌํ˜„ํ•ด๋„ ์ข‹์€ ๊ณต๋ถ€๊ฐ€ ๋  ๋“ฏํ•˜๋‹ค.

Middleware in redux

It provides a third-party extension point between dispatching an action, and the moment it reaches the reducer.

Advanced Middleware

โš ๏ธ **GitHub.com Fallback** โš ๏ธ