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
350
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
220
Limpando Seu Código JS Com O Padrão Pub/Sub
filipebarcos
0
180
Tu trabalha em casa?? Que moleza hein!
filipebarcos
0
110
Rediscovering OOP in Rails World
filipebarcos
0
87
jQuery Bad Practices
filipebarcos
2
240
Intro to Ruby
filipebarcos
1
120
Other Decks in Programming
See All in Programming
ISUCON14公式反省会LT: 社内ISUCONの話
astj
PRO
0
180
GAEログのコスト削減
mot_techtalk
0
110
Compose でデザインと実装の差異を減らすための取り組み
oidy
1
300
プログラミング言語学習のススメ / why-do-i-learn-programming-language
yashi8484
0
120
いりゃあせ、PHPカンファレンス名古屋2025 / Welcome to PHP Conference Nagoya 2025
ttskch
1
270
iOSエンジニアから始める visionOS アプリ開発
nao_randd
3
120
バックエンドのためのアプリ内課金入門 (サブスク編)
qnighy
8
1.7k
昭和の職場からアジャイルの世界へ
kumagoro95
1
350
Domain-Driven Transformation
hschwentner
2
1.9k
Amazon Q Developer Proで効率化するAPI開発入門
seike460
PRO
0
110
密集、ドキュメントのコロケーション with AWS Lambda
satoshi256kbyte
0
170
2024年のkintone API振り返りと2025年 / kintone API look back in 2024
tasshi
0
210
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
693
190k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.3k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7.1k
Building Applications with DynamoDB
mza
93
6.2k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.1k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
12
950
Java REST API Framework Comparison - PWX 2021
mraible
28
8.4k
A better future with KSS
kneath
238
17k
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