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
Better async redux saga
Search
Kushan Joshi
June 28, 2017
Technology
1
630
Better async redux saga
Slides on Generator Functions and Redux Saga
Kushan Joshi
June 28, 2017
Tweet
Share
Other Decks in Technology
See All in Technology
アプリケーションの中身が見える!Mackerel APMの全貌と展望 / Mackerel APMリリースパーティ
mackerelio
0
370
カンファレンスのつくりかた / The Conference Code: What Makes It All Work
tomzoh
7
860
大事なのは、AIの精度だけじゃない!〜1円のズレも許されない経理領域とAI〜
jun_nemoto
9
4.9k
KMP導⼊において、マネジャーとして考えた事
sansantech
PRO
1
180
CloudTrailも、GuardDutyも、VPC Flow logsも… ログ多すぎ問題の整理術
nikuyoshi
5
600
Redmineの意外と知らない便利機能 (Redmine 6.0対応版)
vividtone
0
950
それでもぼくらは貢献をつづけるのだ(たぶん) @FOSS4GLT会#002
furukawayasuto
1
260
Introduction to Bill One Development Engineer
sansan33
PRO
0
230
mnt_data_とは?ChatGPTコード実行環境を深堀りしてみた
icck
0
170
GitHub Coding Agent 概要
kkamegawa
1
1.1k
S3 Tables を図解でやさしくおさらい~基本から QuickSight 連携まで/s3-tables-illustrated-basics-quicksight
emiki
1
290
OTel meets Wasm: プラグイン機構としてのWebAssemblyから見る次世代のObservability
lycorptech_jp
PRO
0
260
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
740
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3k
Typedesign – Prime Four
hannesfritz
41
2.6k
A Tale of Four Properties
chriscoyier
159
23k
Building an army of robots
kneath
306
45k
Being A Developer After 40
akosma
91
590k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
Art, The Web, and Tiny UX
lynnandtonic
298
21k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Reflections from 52 weeks, 52 projects
jeffersonlam
349
20k
The Language of Interfaces
destraynor
158
25k
Side Projects
sachag
453
42k
Transcript
GENERATORS REDUX SAGA & Kushan Joshi
KUSHAN JOSHI Mapbox OpenStreetMap @kushan2020
GENERATORS What are Generator Functions ? Are functions that can
hold state They can be paused / resumed on demand.
GENERATORS Unlike functions, Generator functions do not run to completion
"
GENERATORS Should I run?
GENERATORS EXAMPLE
GENERATORS EXAMPLE
GENERATORS EXAMPLE
GENERATORS EXAMPLE is called an iterator
ITERABLE
ITERABLE
ITERABLE
GENERATORS Built in iterables Array, String, Map, Set, TypedArray
GENERATORS EXAMPLE
GENERATORS EXAMPLE
GENERATORS EXAMPLE
GENERATORS EXAMPLE
GENERATORS EXAMPLE
GENERATORS EXAMPLE
GENERATORS EXAMPLE
GENERATORS What are generators, again ? Give you a nice
way to generate an Iterator
GENERATORS Great! Let us look at Redux
REDUX PROBLEM Store ✈ Action
REDUX PROBLEM Store ✈ ✈ ✈ ✈ ✈ Actions
REDUX PROBLEM Store Async Actions? Async-Action
REDUX PROBLEM Store There are a lot of tools to
solve this problem. Async-Action
REDUX PROBLEM Store There are a lot of tools to
solve this problem. Async-Action
REDUX PROBLEM Store There are a lot of tools to
solve this problem. Async-Action
REDUX PROBLEM Store There are a lot of tools to
solve this problem. Async-Action
REDUX PROBLEM Store There are a lot of tools to
solve this problem. Async-Action
REDUX PROBLEM Store There are a lot of tools to
solve this problem. Async-Action
REDUX PROBLEM Store There are a lot of tools to
solve this problem. Async-Action
REDUX PROBLEM Store There are a lot of tools to
solve this problem. Async-Action
REDUX PROBLEM Store There are a lot of tools to
solve this problem. Async-Action
REDUX PROBLEM Store There are a lot of tools to
solve this problem. Async-Action
REDUX PROBLEM Store There are a lot of tools to
solve this problem. Async-Action
REDUX PROBLEM Store There are a lot of tools to
solve this problem. Async-Action
REDUX PROBLEM Store Async-Action Easy bro!
REDUX PROBLEM Store Async-Action One of them is Redux Saga
REDUX SAGA Is a library which helps manage async actions
with generators. 5 Redux Saga
REDUX SAGA It runs the generator functions for you.
It gives you helper functions to interact with Redux
REDUX SAGA ✈
REDUX SAGA ✈
REDUX SAGA
REDUX SAGA
GENERATORS How does it compare with Redux Thunks Nice!
REDUX THUNKS LOGIN WITH THUNKS
REDUX THUNKS LOGIN WITH THUNKS
REDUX THUNKS LOGIN WITH THUNKS
REDUX THUNKS LOGIN WITH THUNKS
SAGA LOGIN WITH SAGA
SAGA LOGIN WITH SAGA
SAGA LOGIN WITH SAGA
SAGA LOGIN WITH SAGA
SAGA LOGIN WITH SAGA
SAGA LOGIN WITH SAGA
THUNKS FEATURE PARITY WITH THUNKS
GENERATORS Isn’t this just too complex for a login
THUNKS
THUNKS FEATURE PARITY WITH THUNKS
NETWORK RACE
NETWORK RACE
NETWORK RACE
NETWORK RACE
SAGA LOGIN WITH SAGA
SAGA LOGIN WITH SAGA
SAGA LOGIN WITH SAGA ✈ Logout!
SAGA LOGIN WITH SAGA Me?
SAGA LOGIN WITH SAGA
SAGA LOGIN WITH SAGA
SAGA LOGIN WITH SAGA
SAGA LOGIN WITH SAGA
SAGA LOGIN WITH SAGA
GENERATORS Can’t you just use Async / Await and be
happy?
SAGA ASYNC AWAIT IMPLEMENTATION OF REDUX SAGA
SAGA ASYNC AWAIT IMPLEMENTATION OF REDUX SAGA
GENERATORS So, are generators useless?
GENERATORS The whole point of generators is that you can
manipulate them while they are suspended.
GENERATORS Think of it as a conversation between the code
that runs the generator and the generator itself. Generator Redux Saga (runner)
GENERATORS Generator Redux Saga (runner)
GENERATORS Generator Redux Saga (runner)
GENERATORS Generator Redux Saga (runner)
GENERATORS Generator Redux Saga (runner)
GENERATORS Generator Redux Saga (runner)
GENERATORS Generator Redux Saga (runner)
GENERATORS Async or any other magical being Redux Saga (runner)
GENERATORS ? Async or any other magical being Redux Saga
(runner)
GENERATORS Which is why it is so easy to test
a redux saga, at every yield @
REDUX SAGA TESTING
REDUX SAGA TESTING
REDUX SAGA TESTING
REDUX SAGA TAKE AWAYS Generator functions are fun Redux Saga
is an amazing solution to the async action problem
REDUX SAGA THANK YOU
REDUX SAGA TAKEAWAY
REDUX SAGA TAKEAWAY
REDUX SAGA TAKEAWAY
REDUX SAGA TAKEAWAY