What's the diff between fetch and xhr type? Which one should I use? or Can someone explain the diff b

16 Replies, 1056 Views

Hey folks!

Quick question – can someone break down the *diff between fetch and xhr type* for me? I've used both but still kinda fuzzy on when to pick one over the other.

From what I get, fetch is newer, promise-based, and cleaner syntax, while XHR (XMLHttpRequest) is the old-school way with more boilerplate. But XHR has progress events, which fetch doesn’t natively support (without extra work).

Any pros/cons y’all wanna share? Like, is fetch always the better choice now, or are there cases where XHR still wins?

Also, anyone run into weird quirks with either? I’ve heard fetch can be tricky with error handling.

Thanks in advance! 🙌

Messages In This Thread
What's the diff between fetch and xhr type? Which one should I use? or Can someone explain the diff b - by - 28-10-2024, 10:59 AM



Users browsing this thread: 1 Guest(s)