Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
JETLS.jl ─ A New Language Server for Julia
abap34
1
400
AIエージェントを活かすPM術 AI駆動開発の現場から
gyuta
0
420
dotfiles 式年遷宮 令和最新版
masawada
1
780
DSPy Meetup Tokyo #1 - はじめてのDSPy
masahiro_nishimi
1
170
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
130
S3 VectorsとStrands Agentsを利用したAgentic RAGシステムの構築
tosuri13
6
310
大体よく分かるscala.collection.immutable.HashMap ~ Compressed Hash-Array Mapped Prefix-tree (CHAMP) ~
matsu_chara
2
220
なあ兄弟、 余白の意味を考えてから UI実装してくれ!
ktcryomm
11
11k
バックエンドエンジニアによる Amebaブログ K8s 基盤への CronJobの導入・運用経験
sunabig
0
160
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
790
ハイパーメディア駆動アプリケーションとIslandアーキテクチャ: htmxによるWebアプリケーション開発と動的UIの局所的適用
nowaki28
0
420
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
230
Featured
See All Featured
Practical Orchestrator
shlominoach
190
11k
Building Adaptive Systems
keathley
44
2.9k
Docker and Python
trallard
47
3.7k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.3k
Optimizing for Happiness
mojombo
379
70k
Writing Fast Ruby
sferik
630
62k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Git: the NoSQL Database
bkeepers
PRO
432
66k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.1k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.3k
Context Engineering - Making Every Token Count
addyosmani
9
510
A Tale of Four Properties
chriscoyier
162
23k
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 ·ͨผͷΞϓϩʔν͕ग़͖ͯͨΒࢼͯ͠Έ͍ͨɻ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ