What the 🐠 is a generator?

Well, according to the definition :

Generators are functions which can be exited and later re-entered. Their context (variable bindings) will be saved across re-entrances.

Fancy, what does this bring to the table? 💭

argh, definition again… 💤

Generators in JavaScript — especially when combined with Promises — are a very powerful tool for asynchronous programming

A real world scenario?

After all that definition reading, let’s jump into the core of it. :octocat:

We had an interesting problem on our hands to tackle. It was to enable pagination to one of our mobile app’s on swipe right.

#beginner #es6 #beginners-guide #pagination #javascript

Build infinite pagination with ES6 async generators and iterables
1.45 GEEK