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

16 Replies, 1265 Views

fetch vs xhr? fetch is the cool kid, but xhr’s the old reliable.

big thing ppl miss: xhr works in older browsers outta the box. fetch needs polyfills if you care about IE or ancient mobile browsers.

also, xhr’s `abort()` is straightforward. fetch needs `AbortController`, which feels extra.

tools like `swr` or `react-query` abstract this stuff away tho—might be worth a look!

Messages In This Thread



Users browsing this thread: 1 Guest(s)