
js 비동기 함수
데이터를 요청(input/output)하는 함수로 IO통신이 일어난다.
fetch().then().then()
fetch('요청 주소', { method : "GET" })
.then(res => res.json())
.then(res => {
setValue(res);
});
fetch("요청 주소", {
method : "POST",
headers : {
"Content-Type":"application/json; charset=utf-8"
},body: JSON.stringify(data) })
.then(res=>res.json())
.then(res=> {
console.log(res);
});
• 이벤트 핸들러를 사용하는 경우
• 타이머 함수 사용하는 경우
• 클린업(Clean-up) 함수란?