Is there a difference in the fetch inside the components and outside?
Answered
Somali posted this in #help-forum
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?
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
8 Replies
it caches together within 1 render correct you should not use axios at all in nextjs its outdated and wasteful
@DirtyCajunRice | AppDir it caches together within 1 render correct you should not use axios at all in nextjs its outdated and wasteful
SomaliOP
i already use Ky,
and i wrote it in post 🙂
and i wrote it in post 🙂
@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?
@Somali 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?
one doesnt require prop drilling. other than that its the same amount of network requests
Answer