
웹 서버로 HTTP 요청을 할 수 있으며 XMLHttpRequest 대체가 가능
Request, Response, Headers 객체 등으로 구성
fetch()에 요청하는 URL, method, headers 옵션을 매개변수로 전달 가능하고 결과에 대해 then()으로 콜백 형식으로 처리
- then()은 계속 연결할 수 있으며 이전 메서드의 결과를 활용 할 수 있게 해줌
- 이런 방식으로 계속 연결하는 것을 체이닝이라 부름
```jsx
fetch(URL, [옵션]).then().then()...
```
문자열로 다루는 법
fetch('URL')
.then(response => response.text())
.then(result => {
console.log(result)
})
.catch(error => {
console.log(error)
})
객체로 다루는 법