Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling HTTP requests #24

Open
MickJasker opened this issue Sep 11, 2020 · 1 comment
Open

Handling HTTP requests #24

MickJasker opened this issue Sep 11, 2020 · 1 comment

Comments

@MickJasker
Copy link

What should the standard be for handling HTTP requests in your project?

There are multiple options:

Axios

Pros

  • Already being used in current projects
  • Compatible with older browsers like IE

Cons

  • Uses XHR, a quite outdated technique to handle HTTP requests

Size: 13.4kB minified (https://bundlephobia.com/result?p=axios@0.20.0)

Fetch

Pros

  • Native to modern browsers, so no external package required

Cons

Size: native

Redaxios

Pros

  • Uses the API of Axios but uses Fetch under the hood
  • Easy to upgrade from Axios
  • Way smaller package size then Axios

Cons

Size: 1.9kB minified (https://bundlephobia.com/result?p=redaxios@0.3.0)

@psimk
Copy link

psimk commented Sep 11, 2020

redaxios also implements the AbortController, so we will finally be able to cancel our requests. This will be especially useful in React, where we could cancel pending requests, whenever the component unmounts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants