• dbx12
    link
    fedilink
    arrow-up
    7
    ·
    1 天前

    I’m not ja JS or TS developer, but I’ve never saw the appeal axios has over the standard fetch.

    • Sv443@sh.itjust.works
      link
      fedilink
      arrow-up
      6
      ·
      1 天前

      If you just use it as a substitute for fetch, then yeah, there’s no point.
      Axios has some extra error handling stuff, automatically parses JSON, has interceptor hooks to create “request loadouts”, throws on 4xx and 5xx errors, has a builtin way of timing out requests, and can even do some nonstandard stuff like sending a body on GET requests.

    • Subscript5676@piefed.ca
      link
      fedilink
      English
      arrow-up
      4
      ·
      1 天前

      Axios existed before fetch (and iirc fetch was designed with axios in mind) and comes with bells and whistles that you’d want to have when building against JSON-based API servers. It’s popular for a good reason, which tbf is a rare rnough phenomenon these days in general.