Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Redux のディレクトリ構成を考える

sota ohara
February 01, 2018

Redux のディレクトリ構成を考える

sota ohara

February 01, 2018
Tweet

More Decks by sota ohara

Other Decks in Programming

Transcript

  1. component ઃܭ • Container component • react-redux.connect() Λ࢖ͬͯ redux ʹͭͳ͙

    • Presentational component • view ͷΈΛѻ͏ component • react ͷΈͰ׬݁ͤ͞Δ
  2. Rails style • rails ͷ scaffold Ͱੜ੒͞ΕΔߏ଄ͱࣅ͍ͯΔ • Redux ͷ

    tutorial ͸͜ͷελΠϧΛ࠾༻ • ໾ׂ͕σΟϨΫτϦ͝ͱʹ෼͔Ε͍ͯΔͷͰΘ͔Γ΍͍͢ • ಉ໊͡લͷϑΝΠϧ͕Ͱ͖ͨΓ͢Δ
  3. Domain style • υϝΠϯ͝ͱʹσΟϨΫτϦΛ෼͚ɺͦͷͳ͔ʹ actions ͱ reducers Λͭ͘Δͱ͍͏΋ͷ • actions

    ͱ reducers ͸ 1ର1 Ͱ࡞Δ͜ͱଟ͍ • middleware ͸ configureStore.js Ͱ௥Ճ͢Δ • action types ͸ actions.js ಺ʹॻ͘
  4. Ducks • domain style ʹࣅ͍ͯΔ͕ actions ͱ͔ reducers ͱ͔ΛҰͭͷ ϑΝΠϧʹ·ͱΊͪΌ͏΋ͷ

    • σΟϨΫτϦɺϑΝΠϧ਺͕গͳͯ͘؆ܿ • ҰͭͷϑΝΠϧͷهड़ྔ͕ଟ͘ͳΔ