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 Redux Saga
Search
Filipe Costa
February 11, 2017
Programming
0
300
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
190
Rust for Rubysts
filipebarcos
2
190
Limpando Seu Código JS Com O Padrão Pub/Sub
filipebarcos
0
170
Tu trabalha em casa?? Que moleza hein!
filipebarcos
0
110
Rediscovering OOP in Rails World
filipebarcos
0
80
jQuery Bad Practices
filipebarcos
2
230
Intro to Ruby
filipebarcos
1
110
Other Decks in Programming
See All in Programming
Hanami and htmx
bkuhlmann
0
210
Amazon SQSコンシューマー疎結合への旅 - 出張! #DevelopersIO IT技術ブログの中の人が語る勉強会 #3
quiver
0
260
二郎系ラーメンのコールで学ぶ AST 解析
memory1994
PRO
7
1.7k
大規模Reactアプリのリアーキテクチャ~8万行のTanStack Query移行の軌跡~
kj455
4
950
Tailwind CSSを本気でカスタマイズする方法
fsubal
13
5.2k
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
820
CA.swift19 恋するAIアプリ開発の裏側
oskmr
0
360
Random\Randomizer クラスで日常のあれこれを解決しよう! / Random\Randomizer class solves familiar trouble
cocoeyes02
0
230
TYPO3 v13 – The road to LTS: What's new and new APIs
luisasofie_xoxo
0
200
Code Reviews
bkuhlmann
4
890
From Spring Boot 2 to Spring Boot 3 with Java 22 and Jakarta EE
ivargrimstad
0
1.2k
Semantic search with Django and pgvector
pauloxnet
0
240
Featured
See All Featured
A Tale of Four Properties
chriscoyier
151
22k
Fashionably flexible responsive web design (full day workshop)
malarkey
398
65k
Mobile First: as difficult as doing things right
swwweet
216
8.6k
Designing for Performance
lara
601
67k
Rebuilding a faster, lazier Slack
samanthasiow
73
8.2k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
78
42k
Thoughts on Productivity
jonyablonski
58
3.8k
VelocityConf: Rendering Performance Case Studies
addyosmani
320
23k
A Philosophy of Restraint
colly
197
16k
Automating Front-end Workflow
addyosmani
1356
200k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
GitHub's CSS Performance
jonrohan
1025
450k
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