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
Redux in Production
Search
Sam Yamashita
July 11, 2016
Technology
320
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Redux in Production
Sam Yamashita
July 11, 2016
More Decks by Sam Yamashita
See All by Sam Yamashita
AI が自動テストの分野でどのように使われるのか
unbabel
0
160
Thailand
unbabel
1
91
DX に優れた多言語化ドキュメント作成方法
unbabel
0
540
3 Tips for meeting
unbabel
0
290
What is GitHub Marketplace and good for?
unbabel
0
120
OSS 翻訳と GitLocalize
unbabel
0
560
Introduction to RAIL
unbabel
0
120
CSS Architecture
unbabel
1
79
Git・Githubに関する隠された便利な機能
unbabel
1
430
Other Decks in Technology
See All in Technology
Vibe Coding で作ったプロダクトをどう安全に動かすか / How to Safely Run Products Built with Vibe Coding
glidenote
0
730
Mastering Agentic Development: Harness Engineering for Effective Coding Agents
konippi
3
580
Hermes Agentで、AIが調べて記事を書くブログを作った話
blueb
0
110
ボードゲームの遊び相手をFoundation Modelsで作る / iOSDC Japan 2026
genda
0
200
2026-09-18 gotanda.sre Terraformで複数環境作ったり、複数Stateに分割したりそれとTerragrunt / Terraform multi envs and multi states
masasuzu
4
750
ADKで始める業務改善 - AIエージェント開発時の考えと設計
harappa80
2
290
GitHub Agentic Workflows を触ってみる
htkym
2
700
AI Native Platform Engineering 〜PlatformとAgileで“作る速さ”を“価値”へ〜
uya116
0
180
Lambda MicroVMsは常駐サーバーの代わりに なるか? Kiro Crew を動かして検証してみた / Kiro Crew on Lambda MicroVMs
k_adachi_01
2
240
音声コミュニティを守るAI監視基盤_ 90%以上の入力削減を支えたServerless設計と運用判断
shuheioka123
0
110
開発投資の期待値を上げるプロダクトロードマップづくり ~プロダクトエンジニアが越境して事業を伸ばす~
kekekenta
1
250
C#コードの結合を可視化する Roslyn解析による設計改善と リファクタリング判断
dora56
0
790
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
The Cult of Friendly URLs
andyhume
79
7k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
530
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
510
Site-Speed That Sticks
csswizardry
13
1.5k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
520
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
340
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
440
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.8k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
420
Transcript
JS Night Redux in Production #dcubeio
github.com/sotayamashita twitter.com/sota0805 blog.sotayamashita.com 山下颯太 ソフトウェアエンジニア 株式会社サイバーエージェント 株式会社シロク
今日話すこと • Redux ͱʁ • Flux ͱʁ はじめに Growth Push
• Growth Pushͱʁ • എܠ • վमલͷߏ • վमޙͷߏ • Switch ͩΒ͚ͷ Reducer • ࠶ར༻Մೳͳ Component
Flux とは?
Action Dispatcher Store View Flux ͱʁ ਤ A cartoon intro
to Flux by Lin Clark
Reduxとは?
–Dan Abramov “I didn't actually intend Redux to become a
popular Flux library—I wrote it as I was working on my ReactEurope talk on hot reloading with time travel.” Reduxͱʁ Why use Redux over Facebook Flux?
Reduxͱʁ Store 内の state とそのロジックを分離 todos: [“eat”, “sleep”] todos: [“”,
“”] addTodo: (todo) => {} addTodo: (todo) => {} todos: [“eat”, “sleep”] addTodo: (todo) => {} todos: [“eat”, “sleep”] addTodo: (todo) => {} ߋ৽ 更新 更新 Before After ਤ A cartoon intro to Redux by Lin Clark
Reduxͱʁ State を action から直接上書きしない Before Action 1 Action2 Action
3 state ਤ A cartoon intro to Redux by Lin Clark
Reduxͱʁ State を action から直接上書きしない After Action 1 Action2 Action
3 state 1 state 2 state 3 ਤ A cartoon intro to Redux by Lin Clark
Reduxͱʁ 階層になっている state からなる 1つの大きな state Before dispatcher store store
store log ਤ A cartoon intro to Redux by Lin Clark
Reduxͱʁ ਤ A cartoon intro to Redux by Lin Clark
階層になっている state からなる 1つの大きな state After dispatcher reducer reducer reducer log reducer reducer reducer reducer reducer
Growth Push とは?
Growth Push ͱʁ http://growthpush.com/
վमલͷߏ • クライアントサイド MVC ライブラリ • テンプレートエンジン • Alt JavaScript
• フレームワーク
վमલͷߏ • クライアントサイド MVC ライブラリ • テンプレートエンジン • Alt JavaScript
• フレームワーク この部分を変更
վमޙͷߏ • フレームワーク • フロント SPA
Switch だらけの Reducer
tree . └── reducers ├── index.js ├── application.js ├── notification.js
├── client.js ├── event.js └── tag.js Switch ͩΒ͚ͷ Reducer
http://redux.js.org/docs/basics/Reducers.html Switch ͩΒ͚ͷ Reducer 1 import * as ActionTypes from
' ../actions/todoApp'; 2 3 function todoApp(state = initialState, action) { 4 switch (action.type) { 5 case ActionTypes.SET_VISIBILITY_FILTER: 6 return { 7 ...state, 8 visibilityFilter: action.filter 9 }; 10 default: 11 return state 12 } 13 }
https://github.com/acdlite/redux-actions Switch ͩΒ͚ͷ Reducer 1 const todoApp = handleActions({ 2
SET_VISIBILITY_FILTER: (state, action) => ({ 3 visibilityFilter: action.filter 4 }), 5 }), initialState );
Before After Switch ͩΒ͚ͷ Reducer 1 import * as ActionTypes
from ' ../actions/todoApp'; 2 3 function todoApp(state = initialState, action) { 4 switch (action.type) { 5 case ActionTypes.SET_VISIBILITY_FILTER: 6 return { 7 ...state, 8 visibilityFilter: action.filter 9 }; 10 default: 11 return state 12 } 13 } 1 const todoApp = handleActions({ 2 SET_VISIBILITY_FILTER: (state, action) => ({ 3 visibilityFilter: action.filter 4 }), 5 }), initialState );
再利用可能なコンポーネント
࠶ར༻Մೳͳίϯϙʔωϯτ • Container Components • Presentational Components
࠶ར༻Մೳͳίϯϙʔωϯτ Container Presentational Container と Presentational の関係性 State Presentational Presentational
Presentational
࠶ར༻Մೳͳίϯϙʔωϯτ Container Presentational Container と Presentational の関係性 Store Presentational Presentational
Presentational
࠶ར༻Մೳͳίϯϙʔωϯτ Container Presentational Container と Presentational の関係性 Store Presentational Presentational
Presentational ࠶ར༻͢Δͱ͜
࠶ར༻Մೳͳίϯϙʔωϯτ Container Presentational Container と Presentational の関係性 State Presentational Presentational
Presentational
࠶ར༻Մೳͳίϯϙʔωϯτ Container Components Presentational and Container Components • Redux であれば
connect() を使用してStore をもらうところ • スタイルをもたない傾向にある • 余計な DOM を含まない傾向にある • 例えば、 ユーザーページ、ログインページ
࠶ར༻Մೳͳίϯϙʔωϯτ Container Presentational Container と Presentational の関係性 Store Presentational Presentational
Presentational
࠶ར༻Մೳͳίϯϙʔωϯτ Presentational Components Presentational and Container Components • functional component
で実装できる傾向がある • スタイルをもちます • 実際の DOM を含みます • 例えば、 リスト、モーダル
࠶ར༻Մೳͳίϯϙʔωϯτ Presentational and Container Components 1 const TodoList = ({
todos }) => ( 2 <ul> 3 {todos.map(todo => 4 <Todo 5 key={todo.id} 6 { ...todo} 7 /> 8 )} 9 </ul> 10 ); 1 class todoPage extends React.Component { 2 render() { 3 return ( 4 <div> 5 <TodoList todos={this.props.todos} /> 6 </div> 7 ) 8 } 9 }
࠶ར༻Մೳͳίϯϙʔωϯτ Container Presentational Store Presentational Presentational Presentational
バケツリレー???
࠶ར༻Մೳͳίϯϙʔωϯτ Container Store Container Container Container Container
࠶ར༻Մೳͳίϯϙʔωϯτ 再利用可能とは?
࠶ར༻Մೳͳίϯϙʔωϯτ https://github.com/sotayamashita/curator
最後に
࠷ޙʹ • ドキュメントが充実してる • 日本語だったら @kuy さんの Qiita にある記事とか •
サンプルプロジェクトがたくさん • コミュニティが充実してる • サンプルプロジェクト作ってみた(全然間に合わなかった) • https://github.com/sotayamashita/curator
ご清聴ありがとうございました