I've never used Axios, but I can imagine how it could be more straight forward.
When they announced fetch() as a better API to replace XmlHttpRequest is was expecting a lot more honestly. Gonna check out Axios next time I'm dealing with fetch directly.
Most developers do, but my point wasn't wheather you should use Fetch or not, my point was to simply state that XHR isn't complicated and has more features, regardless of how you and all the other downvoters feel about it.
I've only recently gotten into web design, so all I've used is fetch()! At one point I looked into how to do requests without it and was like "good god, that looks like a pain in the ass"
I tried swapping ajax with fetch in a project but found it handles post variables in an abysmal way. Passing arrays seemed like a major PITA. Have you handled that in your wrapper?
To be honest I can't remember all of what I tried, but when my POST request was interpereted by PHP it did not work with something like $_POST['values'][0...]. I was trying to use it as a drop-in replacement, but it didn't play well with what I had set up already.
27
u/crescentfresh Jul 26 '18
Had to look this up, when tf did this come out?
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch