JavaScript has two major ways of dealing with asynchronous tasks – callbacks and Promises. In general, Promises are considered easier to use and to maintain than callbacks. But, in reality, even Promises alone won’t make you happy. Asynchronous code may still be quite difficult to read and to understand. Therefore, third-party libraries, like co, provide the means to write synchronous-like asynchronous code.

I personally prefer everything in the world to be as clear and beautiful as redux-saga. But not everybody is lucky to work with React and Redux to be able to use sagas. In this article, I will show that in modern JavaScript it is not difficult to write well structured and easy to understand asynchronous code without using any third-party libraries.

Source: DZone