Skip to Content
자바스크립트 + 리액트 디자인 패턴
book

자바스크립트 + 리액트 디자인 패턴

by 애디 오스마니(Addy Osmani), 윤창식
August 2024
Beginner to intermediate
384 pages
7h 38m
Korean
Hanbit Media, Inc.
Content preview from 자바스크립트 + 리액트 디자인 패턴
208
자바스크립트 + 리액트 디자인 패턴
return;
}
// data1, data2, data3을 다루기
});
});
});
이 예제의
makeRequest1
함수는 네트워크 요청을 수행하고 요청 결과를 매개변수로 하여
콜백 함수를 호출합니다. 이 콜백 함수는 다시
makeRequest2
함수를 이용하여 또 다른 네트
워크 요청을 수행하고, 그에 대한 결과를 또 다른 콜백 함수로 전달합니다. 이러한 패턴은 세
번째 네트워크 요청까지 계속됩니다.
9.3
프로미스 패턴
프로미스
Promise
는 자바스크립트에서 비동기 작업을 처리하는 최신 방법입니다. 프로미스는
비동기 작업의 결과를 나타내는 객체로, 대기
pending
, 완료
fulfilled
, 거부
rejected
의 세 가지 상태를
가질 수 있습니다. 작업이 성공적으로 완료되었거나 거부되었을 때 결과를 제공하는 일종의
계약서 같은 존재입니다.
프로미스는
Promise
생성자를 사용하여 만들 수 있으며, 이 생성자는 함수를 인수로 받습니
다. 또다시 이 함수는
resolve
와
reject
두 개의 인수를 전달받습니다.
resolve
함수는 비
동기 작업이 성공적으로 완료되었을 때 호출되고,
reject
함수는 작업이 실패했을 때 호출
됩니다.
다음은 네트워크 요청을 위해 프로미스를 사용하는 방법을 보여주는 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

실전 시계열 분석: 통계와 머신러닝을 활용한 예측 기법

실전 시계열 분석: 통계와 머신러닝을 활용한 예측 기법

박찬성, 에일린 닐슨
클라우드 엔지니어를 위한 97가지 조언

클라우드 엔지니어를 위한 97가지 조언

Emily Freeman, Nathen Harvey, 정기훈(Jung Ki Hun)

Publisher Resources

ISBN: 9791169212571