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
370
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
210
Rust for Rubysts
filipebarcos
2
240
Limpando Seu Código JS Com O Padrão Pub/Sub
filipebarcos
0
190
Tu trabalha em casa?? Que moleza hein!
filipebarcos
0
120
Rediscovering OOP in Rails World
filipebarcos
0
90
jQuery Bad Practices
filipebarcos
2
250
Intro to Ruby
filipebarcos
1
120
Other Decks in Programming
See All in Programming
AIと人間の共創開発!OSSで試行錯誤した開発スタイル
mae616
2
830
GC25 Recap: The Code You Reviewed is Not the Code You Built / #newt_gophercon_tour
mazrean
0
130
Swift Concurrency 年表クイズ
omochi
3
190
SwiftDataを使って10万件のデータを読み書きする
akidon0000
0
250
釣り地図SNSにおける有料機能の実装
nokonoko1203
0
200
Blazing Fast UI Development with Compose Hot Reload (Bangladesh KUG, October 2025)
zsmb
2
430
CSC305 Lecture 12
javiergs
PRO
0
240
ドメイン駆動設計のエッセンス
masuda220
PRO
15
6.6k
オンデバイスAIとXcode
ryodeveloper
0
300
三者三様 宣言的UI
kkagurazaka
0
290
開発組織の戦略的な役割と 設計スキル向上の効果
masuda220
PRO
10
1.9k
TFLintカスタムプラグインで始める Terraformコード品質管理
bells17
2
500
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
57
6k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
A Tale of Four Properties
chriscoyier
161
23k
The World Runs on Bad Software
bkeepers
PRO
72
11k
Leading Effective Engineering Teams in the AI Era
addyosmani
7
680
Understanding Cognitive Biases in Performance Measurement
bluesmoon
31
2.7k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
190
55k
Visualization
eitanlees
150
16k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
2.9k
Code Reviewing Like a Champion
maltzj
526
40k
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