Redux-Saga utilizes a new ES6 feature called generators. Generators are functions which can be exited and later re-entered.
Simply calling a generator function, marked by the asterisk to the right of the function keyword, will not cause the body of the function to execute immediately. Instead an iterator object is returned (e.g., gen in the above example). When the iterator’s next method is invoked, the generator function’s body is executed up until the first yield (e.g., line 2 above). The iterator’s next method returns an object with a value property containing the yielded value and a done boolean property, which indicates whether the generator has yielded its last value.
But let’s take a step back. What is yield?
Line 2 above is called a ‘yield expression’ because when you restart the generator, you will send back in the value and it will be used as the newly evaluated value. In essence, the yield keyword makes a request for a value.