Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[문제] fetch VS XMLHttpRequest #18

Open
live-small opened this issue Sep 11, 2021 · 1 comment
Open

[문제] fetch VS XMLHttpRequest #18

live-small opened this issue Sep 11, 2021 · 1 comment
Labels

Comments

@live-small
Copy link
Owner

질문

비동기 프로그래밍이 가능한 fetch APIXMLHttpRequest 객체의 차이점은 무엇일까요?

MDN에 따르면 XMLHttpRequest에서 fetch로 변화했다고 하는데, 어떤 점이 달라졌는지, 둘의 동작방식의 차이 등에 대해서
공부해보면 좋을 거 같습니다.

여러분은 주로 어떤 것을 써왔나요? 그 이유 혹은 장점은 어떤 게 있나요?

저는 fetch만 써봤고, XMLHttpRequest에 대해서는 책에서 간략히 언급한 내용밖에 모르는 상태지만, XMLHttpRequest보다 추상화 되어있어 직관적으로 이해하고 쓰기 편한거 같습니다.

관련 챕터

43장

참고

https://developer.mozilla.org/ko/docs/Web/API/Fetch_API/Using_Fetch

@jessi68
Copy link
Collaborator

jessi68 commented Sep 21, 2021

fetch api 와 XmlHttpResuest 모두 웹 페이지가 사용자가 현재 하고 있는 것을 방해하지 않으면서 페이지의 일부를 업데이트할 수 있도록 도와주는 비동기 기능이라는 점에서는비슷하지만, 또한 fetch 의 경우에는 request 와 response 에 대해 Cache api 를 사용할 수 있지만, XHR 은 그렇지 않고, XHR 에서 할수는 있지만 fetch 에 할 수 없는 것은 request 를 취소하는 것이라고 합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants