Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Redux in Production
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
88
DX に優れた多言語化ドキュメント作成方法
unbabel
0
540
3 Tips for meeting
unbabel
0
280
What is GitHub Marketplace and good for?
unbabel
0
120
OSS 翻訳と GitLocalize
unbabel
0
550
Introduction to RAIL
unbabel
0
110
CSS Architecture
unbabel
1
77
Git・Githubに関する隠された便利な機能
unbabel
1
420
Other Decks in Technology
See All in Technology
NAB Show 2026 動画技術関連レポート / NAB Show 2026 Report
cyberagentdevelopers
PRO
0
170
失敗を資産に変えるClaude Code
shinyasaita
0
480
エラーバジェットのアラートのタイミングを考える.pdf
kairim0
0
120
2026TECHFRESH畢業分享會 - Lightning Talk - E起 See See : 電商推薦讀心術? 數據說了算
line_developers_tw
PRO
0
810
ルールやカスタム機能、どう活かす?ハンズオンで体感するIBM Bobの出力コントロール
muehara
1
130
2026TECHFRESH畢業分享會 - 原生還是跨平台? App 開發踩坑實錄
line_developers_tw
PRO
0
820
Socrates × Looker 〜セマンティックレイヤーで進化するデータ分析エージェント〜
hanon52_
3
2.1k
Agent Skills設計で柔軟性と硬さのバランスが難しい話
nassy20
0
120
2026TECHFRESH畢業分享會 - AI 時代的人生存檔點
line_developers_tw
PRO
0
820
AIっぽい文章を採点して人間らしく直すアプリを作ってみた
yama3133
2
130
2026 TECHFRESH 畢業分享會 - 開發日常大解密!從領域驅動到企業級上線
line_developers_tw
PRO
0
810
Disciplined Vibes: Scaling AI-Assisted Engineering
sheharyar
0
130
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
37
7.3k
Writing Fast Ruby
sferik
630
63k
The SEO Collaboration Effect
kristinabergwall1
1
480
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
54k
HDC tutorial
michielstock
2
700
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
450
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
From π to Pie charts
rasagy
0
210
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
530
Become a Pro
speakerdeck
PRO
31
6k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
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
ご清聴ありがとうございました