Next.js Discord

Discord Forum

axios vs fetch as http request solution for Next.js

Unanswered
Bonga shad posted this in #help-forum
Open in Discord
Bonga shadOP
Is there any benefit to use native fetch over axios for fetching in next.js? Ive heard next js provides the wrapper around fetch so I am wondering is by using axios you would loose some caching default functionality etc

5 Replies

yeah, exactly
Next.js extends native fetch with lots of caching algorithms
It is generally preferred to use fetch in a Next.js app for two reasons:

1. It's already fully built in, extended, and officially supported by next (as forementioned)
2. smaller bundle size. it's already there, why add another library that does the same thing?

But, it's not sacrilege to use Axios if you heavily prefer it's client API over fetch