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 PINGPONG
Search
yutasuzuki
June 03, 2017
Programming
0
130
Redux PINGPONG
Nagoya.jsの飛び入りで発表させていただいた資料です。
自分の所感です。
yutasuzuki
June 03, 2017
Tweet
Share
More Decks by yutasuzuki
See All by yutasuzuki
ECMAScript Promise
yutasuzuki
1
310
Other Decks in Programming
See All in Programming
AI時代のソフトウェア開発を考える(2025/07版) / Agentic Software Engineering Findy 2025-07 Edition
twada
PRO
14
1.7k
deno-redisの紹介とJSRパッケージの運用について (toranoana.deno #21)
uki00a
0
170
新メンバーも今日から大活躍!SREが支えるスケールし続ける組織のオンボーディング
honmarkhunt
1
480
AIエージェントはこう育てる - GitHub Copilot Agentとチームの共進化サイクル
koboriakira
0
480
datadog dash 2025 LLM observability for reliability and stability
ivry_presentationmaterials
0
430
Result型で“失敗”を型にするPHPコードの書き方
kajitack
4
570
GitHub Copilot and GitHub Codespaces Hands-on
ymd65536
1
140
Select API from Kotlin Coroutine
jmatsu
1
220
dbt民主化とLLMによる開発ブースト ~ AI Readyな分析サイクルを目指して ~
yoshyum
2
260
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
1
580
Azure AI Foundryではじめてのマルチエージェントワークフロー
seosoft
0
150
ニーリーにおけるプロダクトエンジニア
nealle
0
720
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Testing 201, or: Great Expectations
jmmastey
42
7.6k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
124
52k
Bash Introduction
62gerente
614
210k
What's in a price? How to price your products and services
michaelherold
246
12k
Embracing the Ebb and Flow
colly
86
4.7k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
Become a Pro
speakerdeck
PRO
28
5.4k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
Transcript
3FEVY1*/(10/(
None
ࢼͨ͠ϥΠϒϥϦ w SFEVYUIVOL w SFEVYTBHB w SFEVYPCTFSWBCMF
5SFOET
ࠓճ࡞ͬͨͷ ΫϦοΫ͢Δͱ1*/(Λมߋɻ̎ඵޙʹ10/(Λݩʹ͢ɻ
جຊతͳDPEF import { createAction } from 'redux-actions'; export const PONG
= 'PONG'; export const pong = createAction(PONG); export const PING = 'PING'; export const ping = createAction(PING); import { combineReducers } from 'redux' import { PONG, PING } from '../actions/' const reducer = (state = false, action) => { switch (action.type) { case PONG: return state = false break; case PING: return state = true default: return state } }; const reducers = combineReducers({ isPingPong: reducer }); export default reducers BDUJPOKT SFEVDFSKT
SFEVYUIVOL
SFEVYUIVOLͱ w 3FEVYᴈ໌ظ͔Β͍ΔϥΠϒϥϦɻ w ࡞ऀಉ͡ͳͷͰɺ΄΅ެࣜɻ w "DUJPOʹඇಉظͷϩδοΫΛԡ͠ࠐΜͰ͍͘ελΠϧɻ
SFEVYUIVOL import { createAction } from 'redux-actions' export const SYNC_EVENT
= 'SYNC_EVENT' export const syncEvent = createAction(SYNC_EVENT) export const ASYNC_EVENT = 'ASYNC_EVENT' export const asyncEvent = createAction(ASYNC_EVENT) export function asyncPingPong() { return (dispatch) => { dispatch(ping()) setTimeout(() => { dispatch(pong()) }, 2000) } } const mapDispatchToProps = (dispatch) => { return { onClickHandler: () => { dispatch(asyncPingPong()) } } } BDUJPOKT DPOUBJOFSKT
SFEVYUIVOLͷײ w "DUJPO$SFBUPS"DUJPOΦϒδΣΫτΛੜ͢Δ͚ͩʹ͍ͨ͠ɻ w ϥΠϒϥϦ͕ܰྔͳͷͰɺཧղ͍͢͠ɻ ࣮࣭ߦ͔͠ͳ͍ w ࠷ϝδϟʔͳ3FEVYͷඇಉظϥΠϒϥϦͳͷͰɺࣄྫ͕ଟ͍ɻ w
ࠓճͬͨඇಉظϥΠϒϥϦͰɺҰ൪ϋʔυϧ͕͍ɻ w ෳࡶͳϩδοΫΛ͜͜ʹԡ͠ࠐΉͷɺݸਓతʹඍົɻ
SFEVYTBHB
SFEVYTBHBͱ w δΣωϨʔλؔΛ༻͠ɺඇಉظͷॲཧΛಉظతʹॻ͚ΔΑ͏ʹͳΔɻ w SFEVYͷॲཧ͔ΒNJEEMFXBSFΛ༻͍ͯɺผεϨουʹΓग़͢Πϝʔδɻ action reducer saga
SFEVYTBHB import { delay } from 'redux-saga' import { put,
takeEvery } from 'redux-saga/effects' import { ping, PONG } from '../actions' function* pingPongSaga() { yield delay(2000) yield put(ping()) } export function* rootSaga() { yield takeEvery(PONG, pingPongSaga) } TBHBKT
SFEVYTBHBͷײ w ීஈશ͍ͬͯ͘ͳ͍δΣωϨʔλؔΛ৮Δ͖͔͚ͬʹͳͬͨɻ w SFEVYUIVOLͷ"DUJPOԚછ͔Βղ์ɻ w νʔϜ։ൃʹಋೖ͢ΔͱͳΔͱɺશମతʹֶशίετߴΊͩͱࢥ͏ɻ
SFEVYPCTFSWBCMF
SFEVYPCTFSWBCMFͱ w 3FBDUJWF9 3FBDUJWF&YUFOTJPO Λ༻੍͍ͨޚ͕Ͱ͖Δɻ w NJEEMFXBSFͰ"DUJPOΛड͚औͬͯɺ"DUJPOΛฦ͢ॲཧΛ&QJDͱݺͿɻ w SYKTʹґଘ͍ͯ͠Δɻ w
ެࣜϖʔδΛݟΔͱ/FUqJYͷϓϩμΫτʹݟ͑Δɻ
SFEVYPCTFSWBCMF import { createEpicMiddleware } from ‘redux-observable' import 'rxjs/add/operator/delay' import
'rxjs/add/operator/mapTo' import { PING, pong } from '../actions' const epic = (action$) => { return action$.ofType(PING) .delay(2000) .mapTo(pong()) } const epicMiddleware = createEpicMiddleware( epic ) export default epicMiddleware FQJDKT
SFEVYPCTFSWBCMFͷײ w ࠷ۙͷ3YʓʓͳྲྀΕ͔Β͢ΔͱɺΔՁ͋Γͦ͏ɻ w ॲཧͷϑϩʔ͕ݟ͍͢ɻ w খ͍͞ϓϩμΫτʹSYKTΛೖΕΔͷԿͱͳ͘ؾ͕Ҿ͚Δɻ
·ͱΊ
·ͱΊʢݸਓͷओ؍ʣ w ݸਓతͳΈ SFEVYUIVOLSFEVYPCTFSWBCMFSFEVYTBHB w ϓϩμΫτͷαΠζ͕খ͚͞ΕUIVOL͏ͱࢥ͏ɻ w ·ͨผͷΞϓϩʔν͕ग़͖ͯͨΒࢼͯ͠Έ͍ͨɻ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ