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
330
Other Decks in Programming
See All in Programming
Raku Raku Notion 20260128
hareyakayuruyaka
0
300
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
200
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.6k
AI巻き込み型コードレビューのススメ
nealle
2
340
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
7
2.3k
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
3.9k
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
SourceGeneratorのススメ
htkym
0
200
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
5
730
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
140
2026年 エンジニアリング自己学習法
yumechi
0
140
CSC307 Lecture 07
javiergs
PRO
0
550
Featured
See All Featured
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
86
How to Talk to Developers About Accessibility
jct
2
130
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
120
How to make the Groovebox
asonas
2
1.9k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
So, you think you're a good person
axbom
PRO
2
1.9k
Become a Pro
speakerdeck
PRO
31
5.8k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
170
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
130
The Curious Case for Waylosing
cassininazir
0
240
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 ·ͨผͷΞϓϩʔν͕ग़͖ͯͨΒࢼͯ͠Έ͍ͨɻ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ