What is Promise Chaining?
A common need is to execute two or more asynchronous operations back to back, where each subsequent operation starts when the previous operation succeeds, with the result from the previous step. We accomplish this by creating a promise chain.
In the old days, doing several asynchronous operations in a row would lead to the classic callback pyramid of doom:
With modern functions, we attach our callbacks to the returned promises instead, forming a promise chain:
Reference:
Categories :
JavaScript