Lightweigt alternative to Axios

Using Redaxios instead of Axios as a small alternative

Tom • Tools & Development, Coding Guides •

Axios, but in a couple of Bytes

This is just a very small post, but I was recently looking for an alternative to Axios for fetching content on the client, as Axios is quite large. I want to add as few Bytes as possible to my PWA, as I want to ensure a good SEO-score based on page size.

Of course I could use the native “fetch”-function that’s available in every modern browser. But the ergonomics of Axios are just very good, and that’s where Redaxios shines. The link to the library is also in the addendum at the end of this page.

A wrapper around “fetch”

Redaxios is just a wrapper around fetch, with the same API as Axios but without the library’s size. This means that you don’t have to worry about adding too much overhead to your page if you want to implement client-side fetches.

Using Redaxios

As said, the API is the same, therefore you already know how to use Redaxios if you’ve used Axios before.

// Only the import is the real difference.
import axios from 'redaxios';

// Now you can use it as 'axios':
axios.get('/user', {
    params: {
      ID: 12345
  .then(function (response) {
  .catch(function (error) {
  .then(function () {
    // always executed

javascriptLanguageCheck out all coding posts



Suggested Posts