0% found this document useful (0 votes)
29 views

Generator Functions Javascript

The document discusses generators and Redux Saga. It explains that generators complement promises by providing an easier way for humans to understand asynchronous code. Generators allow code to pause and resume execution using the yield keyword. Redux Saga uses generators to manage asynchronous logic in Redux applications, providing an alternative to thunks. The document provides examples of communicating with yield, generating values with generators, and comparing Redux Saga to thunks.

Uploaded by

Chahat Kapoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Generator Functions Javascript

The document discusses generators and Redux Saga. It explains that generators complement promises by providing an easier way for humans to understand asynchronous code. Generators allow code to pause and resume execution using the yield keyword. Redux Saga uses generators to manage asynchronous logic in Redux applications, providing an alternative to thunks. The document provides examples of communicating with yield, generating values with generators, and comparing Redux Saga to thunks.

Uploaded by

Chahat Kapoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

REDUX SAGA &

GENERATORS
Kushan Joshi
GENERATORS

WHY PROMISES HELP

Trustable: You can totally trust them

Composability: Easily compose promise. / chaining?

Inversion of Control:

Error handling:
TEXT

WHATS WITH GENERATORS

Complement Promises not replace them!

They look almost synchronous, easier for humans to


understand

Do lazy stuff // explain more on this

Pause and Resume

Generating Values
TEXT

SIMPLE GENERATOR EXAMPLE


TEXT

COMMUNICATING WITH YIELD

Yield has powerful dual characteristic

Yield Messaging example here


TEXT

GENERATING VALUES WITH GENERATORS


When you execute a generator you get back an iterable.
TEXT

DELEGATING WITH YIELD*


TEXT

INTRODUCTION TO REDUX SAGA


Brief introduction
TEXT

COMPARING WITH THUNKS


TEXT

COMPLEX LOGIN/LOGOUT EXAMPLE


TEXT

REDUX SAGA HELPER FUNCTIONS


TEXT

TESTABILITY

You might also like