fetch is the new standard, but xhr type isn’t going away anytime soon.
fetch:
- Cleaner syntax
- Promise-based
- Less code
xhr:
- More control (timeouts, progress)
- Callback-based
- Verbose
fetch’s error handling is *not* intuitive—it won’t reject on 404/500. You gotta handle that yourself.
If you’re learning, start with fetch. But keep XHR in your back pocket for edge cases.
---
fetch:
- Cleaner syntax
- Promise-based
- Less code
xhr:
- More control (timeouts, progress)
- Callback-based
- Verbose
fetch’s error handling is *not* intuitive—it won’t reject on 404/500. You gotta handle that yourself.
If you’re learning, start with fetch. But keep XHR in your back pocket for edge cases.
---
