Next.js Discord

Discord Forum

Is there a difference in the fetch inside the components and outside?

Answered
Somali posted this in #help-forum
Open in Discord
SomaliOP
Is there a fundamental difference between calling fetch every time inside a component or calling it in the parent component and passing it through props?
I heard that next caches such requests, but does this work in my case?
I'm using the ky library for fetching.
Would this work with axios? As far as I know it uses XMLHttpsRequest?
Answered by DirtyCajunRice | AppDir
one doesnt require prop drilling. other than that its the same amount of network requests
View full answer

8 Replies

it caches together within 1 render correct you should not use axios at all in nextjs its outdated and wasteful
@Somali i already use Ky, and i wrote it in post 🙂
you still asked if it would work with axios.
and the link explains why not to use axios
@DirtyCajunRice | AppDir and the link explains why not to use axios
SomaliOP
yeah, it was just interest, I didn't get it anyway. Is there any difference in one request and passing all the data with props or making different cached requests?
Answer