Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Why Redux?
Search
Takanori Maeda
September 30, 2016
Programming
170
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Why Redux?
社内LT大会用のスライドです。Reduxの紹介。
Takanori Maeda
September 30, 2016
More Decks by Takanori Maeda
See All by Takanori Maeda
モバイルWeb開発最前線 -PWA開発パターン「PRPL」の紹介-
maechabin
0
590
Why React and not jQuery?
maechabin
0
240
最新フロントエンド事情2016年版
maechabin
1
820
Other Decks in Programming
See All in Programming
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
270
AIに “答え“を書かせるのを やめてみた
___akari11
0
120
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
1.2k
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
270
パスワード再設定メールのURLについて知っておこう
uyuki234
0
160
APNsからLive Activityを開始する話
yumnumm
0
170
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
300
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
380
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
390
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
130
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
140
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
270
Featured
See All Featured
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
440
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
540
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
430
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Building Applications with DynamoDB
mza
96
7.2k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
The Curse of the Amulet
leimatthew05
3
16k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
580
My Coaching Mixtape
mlcsv
0
360
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
It's Worth the Effort
3n
188
29k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
Transcript
Why Redux? @maechabin http://redux.js.org/
Reduxͱʁ • WebΞϓϦέʔγϣϯΛߏங͢ΔΞϓϩʔνͷͻͱͭʢঢ়ଶ Λཧ͢ΔͨΊͷϑϨʔϜϫʔΫʣ • ࡞ऀDan Abramovࢯ@Facebook • Facebookͷఏএ͢ΔFluxΞʔΩςΫνϟͷӨڹΛड͚͍ͯΔ •
࠷ॳFluxϑϨʔϜϫʔΫͷͻͱͭʹ͗͢ͳ͔͕ͬͨɺݱࡏ Ұਓউͪঢ়ଶ • ΫϩεϓϥοτϑΥʔϜʹରԠʢΫϥΠΞϯτ / αʔόʔ / ωΠςΟϒͰಈ͘ʣ • Reactͷঢ়ଶΛཧ͢ΔͨΊʹηοτͰΘΕΔ͜ͱ͕ଟ͍ • GitHubͷελʔ23,663ʢ20169݄30ݱࡏʣ
ReduxͷΈ • σʔλҰํʹ͔͠ྲྀΕͳ͍ • ActionɺReducerɺStoreͷ3ͭͷ෦͔ Βߏ͞ΕΔ • Store1ͭͷΞϓϦέʔγϣϯʹඞͣ1 ͭ •
StoreΞϓϦέʔγϣϯશମͷঢ়ଶ ʢStateʣΛObjectπϦʔͱͯ͠อ࣋ • ঢ়ଶʢStateʣImmutable • ঢ়ଶΛʢStateʣΛߋ৽͢Δ།Ұͷํ๏ ɺActionΛൃՐͤ͞Δ͜ͱ • ActionΞΫγϣϯ໊ͱঢ়ଶͷΛ࣋ ͬͨ୯ͳΔΦϒδΣΫτ • Reducer෭࡞༻ͷͳ͍७ਮͳؔɻ ݱࡏͷঢ়ଶͱActionΛҾʹͱΔ
Viewͷ࣮ • جຊతʹPubSubύλʔϯ • StoreͰ༻ҙ͞Ε͍ͯΔAPIΛ͏ ঢ়ଶʢstateʣͷΞΫηε ɹɹɹ=> getState()ϝιου ঢ়ଶʢstateʣͷߋ৽ ɹɹɹ=>
dispatch(action)ϝιου ϦεφʔΛొ ɹɹɹ=> subscribe(listener)ϝιου Ϧεφʔͷొղআ => subscribe(lstener)ϝιου ɹɹɹɹʹΑͬͯฦ͞Εͨؔ // ActionをReducerに伝播 store.dispatch(actionCreators()); // stateの状態を購読。状態に変化が // あったらリスナーを実行 store.subscribe(() => { /* リスナーの処理を書く */ // stateを取得 store.getState(); }); Viewͷ࣮ྫ
ReactͰReduxΛ͏ • ReactViewʹಛԽͨ͠ϥΠϒϥϦͰ͋ΓɺΞϓ Ϧέʔγϣϯͷن͕େ͖͘ͳΔͱঢ়ଶͷཧ ͕ෳࡶʹͳΓɺઃܭ͕͘͠ͳΔ͔Β • ReactͷίϯϙʔωϯτؒͷόέπϦϨʔΛճආ ͍͔ͨ͠Β • ༩͑ΒΕͨʹج͍ͮͯίϯϙʔωϯτ͕Ϩϯμ
Ϧϯά͞ΕΔΑ͏ʹͳΔͨΊReactͷςετ͕؆ ୯ʹͳΔ͔Β ReactͰReduxΛ͏ཧ༝
ReactͰReduxΛ͏ʹʁ React-ReduxʢnpmʣΛͬͯReactͱ࿈ܞ https://github.com/reactjs/react-redux ͍ํͳͲͷৄࡉࢲͷϒϩάهࣄΛࢀরʂ ↓ Reduxͷ࣮ͱReactͱͷ࿈ܞΛγϯϓϧͳαϯ ϓϧΛͬͯղઆ http://mae.chab.in/archives/2885
·ͱΊ • ΞϓϦέʔγϣϯͷঢ়ଶΛͻͱͭͷॴͰอ ࣋͢ΔͨΊɺঢ়ଶͷཧָ͕ʹͳΔ • ΞϓϦέʔγϣϯ͕ෳࡶʹͳ͖ͬͯͨͱ͖ͷ εέʔϧՄೳ • ReactͰͷ։ൃ͕ΑΓָ͘͠ͳΔ •
ͨͩ͠Viewͷ࣮ReactͰͳͯ͘ྑ͍ • ྲྀߦ͖͍ͬͯͯΔͷͰ͓͍֮͑ͯͯଛͳ͠
https://github.com/reactjs/redux ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ