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
AGENTS.mdとSkillsで始めるAIエージェント活用
sonoda_mj
3
200
2026TECHFRESH畢業分享會 - Lightning Talk - 打造精準高效的 MCP 設計模式與測試實務
line_developers_tw
PRO
0
820
Bucharest Tech Week 2026 - Reinventing testing practices in the AI era
edeandrea
PRO
1
140
Claude Codeをどのように キャッチアップしているか
oikon48
9
4.9k
新しいVibe Codingと”自走”について
watany
5
290
SONiC Scale-Up Working Group から探る Scale-UpやUltraEthernet機能の実装方法
ebiken
PRO
2
120
Amazon Bedrock AgentCore ワークショップ JAWS UG TOHOKU / amazon-bedrock-agentcore-workshop-jawsug-tohoku-2026
gawa
9
700
Agentic Web
dynamis
1
200
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.9k
日本 Fintech 未来予測レポート 2027〜2028年(オリジナル版)
8maki
0
1.8k
小さくはじめるSLI/SLO ~育てながら組織に定着させる実践知~ / Starting Small with SLI/SLOs: Building Adoption Through Continuous Growth
nari_ex
5
1.8k
Chainlitで作るお手軽チャットUI
ynt0485
0
200
Featured
See All Featured
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
230
Statistics for Hackers
jakevdp
799
230k
Building an army of robots
kneath
306
46k
Navigating Weather and Climate Data
rabernat
0
220
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
200
How to make the Groovebox
asonas
2
2.2k
Code Reviewing Like a Champion
maltzj
528
40k
HDC tutorial
michielstock
2
700
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
440
Speed Design
sergeychernyshev
33
1.8k
Facilitating Awesome Meetings
lara
57
7k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
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
ご清聴ありがとうございました