Replace axios with a simple custom fetch wrapper (kentcdodds.com)

Kent C. Dodds argues that in the browser you can often replace axios with a small custom wrapper around the native fetch API. He shows how to handle non-OK HTTP responses, send JSON request bodies, attach JWT authorization headers, and automatically handle 401 responses by logging the user out. The overall point is that fetch plus a tailored wrapper can be simpler and lighter when you only need a subset of axios’s features.

April 01, 2026 17:50 Source: Hacker News