DEV Community

Discussion on: Easy Introduction to JavaScript Generators

Collapse
 
misterhtmlcss profile image
Roger K.

I was thinking of using a Generator to create that continuous loading effect that I've seen on websites like Facebook or pagination too. Would these be good usecases?

Thread Thread
 
aumayeung profile image
John Au-Yeung

You can use async generators to get data for infinite scrolling.

Probably don't need generators for pagination as much since you're overwriting existing data.

Thread Thread
 
misterhtmlcss profile image
Roger K.

True on that point and awesome to hear that it's a good solution for the first point. Still trying to get my head around good use cases, because it's just not obvious to me when I first, second and 10th time heard about them.

Thanks for your support and feedback!