I'm really curious about the usage of JavaScript generator functions among web developers, both frontend and backend. How often do you find yourself using them in various contexts, like learning new concepts, personal projects, or work-related tasks?
4 Answers
You usually don't search for patterns like this intentionally. When your code starts feeling messy, that's often when patterns find you, making your life easier without you planning it ahead.
I can recall one instance where I used an async generator function to fetch a page of items from DynamoDB. It allowed me to let the caller decide when to fetch the next page. While it wasn't necessary to use a generator, it just felt like a perfect fit for that situation, and honestly, it made me feel a bit fancy!
I've never used them in my work, honestly. I even forgot about their existence until I stumbled upon this discussion.
I regularly use Redux Sagas, so yes, generator functions come into play quite often for me. They've been really useful in managing side effects seamlessly.
Related Questions
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically
[Centos] Delete All Files And Folders That Contain a String