Next.js Discord

Discord Forum

Should I use native Fetch or a library like Ky?

Answered
French Spaniel posted this in #help-forum
Open in Discord
Avatar
French SpanielOP
Hi, all
This is a very simple question, I have extensively used fetch while I do vanilla JS. But In react ecosystem I use axios, just to use interceptors. I do love fetch but again, with native fetch there is much code to write. So, I came across this really small library called, Ky. Should I use this or not, will I loose fetch features like caching.
Answered by Korat
ky is built based on Fetch API so it has all the fetch features
View full answer

5 Replies

Avatar
Korat
ky is built based on Fetch API so it has all the fetch features
Answer
Avatar
French SpanielOP
That's what I am thinking, so the extension nextJs did like caching and revalidate will work with Ky?
Avatar
Korat
that's correct
Avatar
French SpanielOP
Ok thanks for the clarification @Korat
Avatar
Asian black bear
In case you missed it, here is some info on why axios wouldn't have been a great choice within Next anyways: https://www.adios-axios.com