Promise hell과 Promise chain

트리플엑스랩 | TriplexLab

개요


1. 프로미스 동기화 패턴


1.1 Nested Promise (중첩된 Promise)

Promise1
Promise2
Promise3

Promise1.then(() => {
		Promise2.then(() => {
				Promise3.then(() => {
				
				});
		});
});

1.2 Promise Chain

Promsie1
Promise2
Promise3

Promise1
	.then(() => {
		return Promise2;
	})
	.then(() => {  //Promise2의 then
		return Promise3;
	})
	.then(() => {
				//Promise3의 then
	});

2. Chain error handle