Implementing SSR
Answered
Eurasian Blackbird posted this in #help-forum
Eurasian BlackbirdOP
Hello ! I was reading this article https://dev.to/peibolsang/experimenting-with-every-nextjs-14-rendering-option-from-ssg-to-partial-pre-rendering-2il1
because I am completely confuse about the differents rendering method given by Next. My question is :
Is there a way to re generate the page on every demand (what I presume is Server side rendering, title 3 in the article) using App router, without using unstable way ?
I guess that there is probably the answer in the documentation, but I didn't find a clear one, I'm sorry if the question is stupid.
Thank you
because I am completely confuse about the differents rendering method given by Next. My question is :
Is there a way to re generate the page on every demand (what I presume is Server side rendering, title 3 in the article) using App router, without using unstable way ?
I guess that there is probably the answer in the documentation, but I didn't find a clear one, I'm sorry if the question is stupid.
Thank you
Answered by Plott Hound
Yes you can use SSR by simply not caching your fetching. Using ‘fetch’ will be cached by default unless you pass an argument:
const dynamicData = await fetch(
If you are fetching from a database using an orm it will not be cached by default.
Generally speaking a more ISR approach is preferred as you get the benefits of fresh data when you need it and cached data for when it hasn’t changed. This can be achieved with things like revalidatePath
https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating
const dynamicData = await fetch(
https://..., { cache: 'no-store' })If you are fetching from a database using an orm it will not be cached by default.
Generally speaking a more ISR approach is preferred as you get the benefits of fresh data when you need it and cached data for when it hasn’t changed. This can be achieved with things like revalidatePath
https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating
3 Replies
Plott Hound
Yes you can use SSR by simply not caching your fetching. Using ‘fetch’ will be cached by default unless you pass an argument:
const dynamicData = await fetch(
If you are fetching from a database using an orm it will not be cached by default.
Generally speaking a more ISR approach is preferred as you get the benefits of fresh data when you need it and cached data for when it hasn’t changed. This can be achieved with things like revalidatePath
https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating
const dynamicData = await fetch(
https://..., { cache: 'no-store' })If you are fetching from a database using an orm it will not be cached by default.
Generally speaking a more ISR approach is preferred as you get the benefits of fresh data when you need it and cached data for when it hasn’t changed. This can be achieved with things like revalidatePath
https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating
Answer
Eurasian BlackbirdOP
Okay perfect, that's exactly what I needed, thank you very much !
Plott Hound
Your welcome ðŸ™