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
400
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Pitch - Lidando com Efeitos Colaterais com Redux Saga
Pitch para palestrar no CEJS 2017.
Filipe Costa
February 11, 2017
More Decks by Filipe Costa
See All by Filipe Costa
Lidando com Efeitos Colaterais com Redux Saga
filipebarcos
0
230
Rust for Rubysts
filipebarcos
2
260
Limpando Seu Código JS Com O Padrão Pub/Sub
filipebarcos
0
200
Tu trabalha em casa?? Que moleza hein!
filipebarcos
0
130
Rediscovering OOP in Rails World
filipebarcos
0
100
jQuery Bad Practices
filipebarcos
2
270
Intro to Ruby
filipebarcos
1
140
Other Decks in Programming
See All in Programming
Go 1.27 における memory allocation の高速化
andpad
0
300
MySQLとPostgreSQLって何が違うの?
akagami
0
130
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
160
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
3
1.8k
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
220
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
200
Dockerfile CMD for Node.js
grazie1999
0
120
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
110
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
240
typoなんかねぇよ
raspython3
0
510
片田舎のおっさん、 Swift Buildのダイアモンド問題解決の不具合修正PRを出すが、解決方法がキャッシュをしないようにすることであり、ビルド時間が伸びると言われてマージされないので高速化もする/swiftbuild
yimajo
0
270
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
350
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1033
470k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
500
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
350
Technical Leadership for Architectural Decision Making
baasie
3
530
Designing for Performance
lara
611
70k
Become a Pro
speakerdeck
PRO
31
6.2k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
480
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
500
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