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
Pitch - Lidando com Efeitos Colaterais com Redu...
Search
Filipe Costa
February 11, 2017
Programming
0
360
Pitch - Lidando com Efeitos Colaterais com Redux Saga
Pitch para palestrar no CEJS 2017.
Filipe Costa
February 11, 2017
Tweet
Share
More Decks by Filipe Costa
See All by Filipe Costa
Lidando com Efeitos Colaterais com Redux Saga
filipebarcos
0
200
Rust for Rubysts
filipebarcos
2
240
Limpando Seu Código JS Com O Padrão Pub/Sub
filipebarcos
0
180
Tu trabalha em casa?? Que moleza hein!
filipebarcos
0
120
Rediscovering OOP in Rails World
filipebarcos
0
89
jQuery Bad Practices
filipebarcos
2
240
Intro to Ruby
filipebarcos
1
120
Other Decks in Programming
See All in Programming
iOSアプリ開発で 関数型プログラミングを実現する The Composable Architectureの紹介
yimajo
2
210
Benchmark
sysong
0
270
なんとなくわかった気になるブロックテーマ入門/contents.nagoya 2025 6.28
chiilog
1
210
Deep Dive into ~/.claude/projects
hiragram
8
1.5k
Select API from Kotlin Coroutine
jmatsu
1
190
Composerが「依存解決」のためにどんな工夫をしているか #phpcon
o0h
PRO
1
230
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
240
型付きアクターモデルがもたらす分散シミュレーションの未来
piyo7
0
810
「Cursor/Devin全社導入の理想と現実」のその後
saitoryc
0
160
Cline指示通りに動かない? AI小説エージェントで学ぶ指示書の書き方と自動アップデートの仕組み
kamomeashizawa
1
580
Google Agent Development Kit でLINE Botを作ってみた
ymd65536
2
190
High-Level Programming Languages in AI Era -Human Thought and Mind-
hayat01sh1da
PRO
0
270
Featured
See All Featured
Writing Fast Ruby
sferik
628
61k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Producing Creativity
orderedlist
PRO
346
40k
The Invisible Side of Design
smashingmag
299
51k
Unsuck your backbone
ammeep
671
58k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
700
Git: the NoSQL Database
bkeepers
PRO
430
65k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
490
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
4 Signs Your Business is Dying
shpigford
184
22k
Side Projects
sachag
455
42k
Transcript
Lidando com Efeitos Colaterais com Redux Saga @filipebarcos
Redux
"Evolui ideias do Flux, mas evita suas complexidades pegando dicas
do Elm" — github.com/reactjs/redux Redux
Redux UI Reducer Store Action dispatched (currentState, action) => newState
New State
Redux UI Middleware Reducer Store Action dispatched (currentState, action) =>
newState New State Action forwarded Action dispatched
Redux Saga
github.com/redux-saga/redux-saga
JavaScript Generator Functions*
ES6
Podemos paralisar a execução da função
function* foo(x) { const y = 2 * (yield (x
+ 1)); const z = yield (y / 3); return (x + y + z); } var it = foo(5); // note: not sending anything into `next()` here console.log(it.next()); // { value:6, done:false } console.log(it.next(12)); // { value:8, done:false } console.log(it.next(13)); // { value:42, done:true } https://davidwalsh.name/es6-generators
import { call, put } from 'redux-saga/effects'; export function* fetchData(action)
{ try { const data = yield call(Api.fetchUser, action.payload.url); yield put({type: "FETCH_SUCCEEDED", data}); } catch (error) { yield put({type: "FETCH_FAILED", error}); } } function* watchFetchData() { yield takeEvery('FETCH_REQUESTED', fetchData); } https://redux-saga.github.io/redux-saga/docs/basics/UsingSagaHelpers.html
import { takeEvery } from 'redux-saga'; // FETCH_USERS function* fetchUsers(action)
{ ... } // CREATE_USER function* createUser(action) { ... } // use them in parallel export default function* rootSaga() { yield takeEvery('FETCH_USERS', fetchUsers); yield takeEvery('CREATE_USER', createUser); } https://redux-saga.github.io/redux-saga/docs/basics/UsingSagaHelpers.html
github.com/filipebarcos/redux-saga-example
gist.github.com/filipebarcos/ 0a137d6ca837c117f999958a365fc5b6
Obrigado. @filipebarcos