Learn NextJS's Superpower ISR in 15 Minutes

  Рет қаралды 40,107

Josh tried coding

Josh tried coding

Күн бұрын

NextJS's Incremental Static Regeneration is a powerful tool for making your dynamic routes BLAZINGLY fast! :D Let's learn how to use it and how to verify that we used it correctly in our app. With ISR, you can convert dynamic routes into pre-rendered, static HTML + JSON routes.
My GitHub: github.com/jos...
ISR Documentation: beta.nextjs.or...
I wish you a lot of fun implementing ISR into your app and seeing the results for yourself. Let me know if you build something cool with it! Cheers

Пікірлер: 66
@livecode247
@livecode247 Жыл бұрын
NextJS SSR, SSG, ISG is probably one of the most timetaking thing to understand. Loved the video!
@joshtriedcoding
@joshtriedcoding Жыл бұрын
Really is, took me a long time myself. Cheers man
@bravefastrabbit770
@bravefastrabbit770 Жыл бұрын
This guy is such a beast he even has the Nike logo tatted above his right cheekbone. Thank you for these videos, they're truly appreciated👏
@merdzhen_k
@merdzhen_k 6 ай бұрын
What about the fact that Next.js official documentation says that revalidation doesn’t work with generateStaticParams? “During revalidation (ISR), generateStaticParams will not be called again” And you can check that it really doesn’t revalidate if you set dynamicParams = false
@khoanhkhactuyetvoi
@khoanhkhactuyetvoi 4 ай бұрын
i try revalidation with generateStaticParams in nextjs14 and it not woking, then i use revalidation in the page
@chiragverse
@chiragverse 3 ай бұрын
Yes, it is not supported. We cannot use it as showed in video
@geoffrey_lee
@geoffrey_lee Жыл бұрын
Great explanation, Josh. There are definitely a lot of great uses for these examples.
@rojahm
@rojahm 5 ай бұрын
thanks. it helped a lot. In addition, revalidation doesn't work for generateStaticParams, whether it's exported separetly or called for the fetch inside generateStaticParams. if you set dynamicParams to false which will only show pages with generated params you'll get a 404 for new pages after build.
@Daddyjs
@Daddyjs 7 ай бұрын
12:49 13:55 pretty sure you would always have to redeploy to see changes in the array you are mentioning because next js says "During revalidation (ISR), generateStaticParams will not be called again" by setting export const revalidate = 60; you are saying every cached fetch request at that page level and below should be revalidated. But generate static params will not rerun and build any new pages in the array you mention. A user would have to go to that route then next js will attempt to build that page.
@facundoflores4763
@facundoflores4763 Жыл бұрын
Cool, would be nice to see, on demand ISR.
@JuicyBenji
@JuicyBenji Жыл бұрын
Supabase had a video that had that a month or so ago
@joshtriedcoding
@joshtriedcoding Жыл бұрын
Good idea, Next 13 has the option to create an API route just for revalidation that you can call whenever you'd like, for example with a webhook from your cms
@thequang9234
@thequang9234 Жыл бұрын
Love your channel ! Glad i found this, hope ur channel grow :)
@realitydesigners
@realitydesigners Жыл бұрын
Love your channel bro. Thanks for this! Learned something new!
@Gyurmatag
@Gyurmatag Жыл бұрын
Is ISR would be great for example a dynamic user created posts blog, like a Twitter clone? Can I revalidate the cache dynamically When somebody uploads a new post?
@Nosleepguy
@Nosleepguy Жыл бұрын
we can do it in next 12. In N13, Vercel was change syntax a bit. But it's so amazing
@vishalsangole836
@vishalsangole836 10 ай бұрын
why should i use ISR if i have to revalidate pages every minute of seconds, shouldn't I just stick to SSR? and also we can use revalidate() function in SSR and i think we are good to go.
@Zagoorland
@Zagoorland Жыл бұрын
I'm glad that you're using typescript by default!
@ikbo
@ikbo 5 ай бұрын
is there no way to revalidate dynamically rather than timer based? So create a new static page for new user only when the new user is added rather than regenerate static pages for all users?
@bwustinbweem
@bwustinbweem Жыл бұрын
Interesting. Love learning new things for Next
@aymenbachiri-yh2hd
@aymenbachiri-yh2hd 2 ай бұрын
Thank you so much, great video
@licokr
@licokr 10 ай бұрын
Thank you so much, you explained every single thing. It was really helpful understanding easily. I have two questions. I set revalidate 60 seconds, when it's built, the static files will be generated. And then there are no users in 10 mins, then somebody comes to the page, does it generate users one more at this point, not every 60 seconds? If I come to think of performance, it should do work like this though. and another question is that does it generate all static files when a user comes in after the revalidate time? Then it means that if there are 10000 users, it generates 10000 static files. I'm not sure if I wrote questions correctly though, anyway, Thank you very much for the awesome video 👍
@vishalsangole836
@vishalsangole836 10 ай бұрын
heres some quetions. is ISR "SSG generator" ? is ISR NextJS version of SSG? why should i be using ISR for short validation time, and why should i use ISR for long revalidation time if i can use SSG? if set revalidate to 3day , is that mean after every 3days new build will be generated ?
@rahimco-su3sc
@rahimco-su3sc Жыл бұрын
you videos are amazing !!! thanks
@rayhanislam7518
@rayhanislam7518 Жыл бұрын
So when I go for server side rendering? any example
@asimalqasmi7316
@asimalqasmi7316 Жыл бұрын
Thanks for your great videos
@rogers2934
@rogers2934 Ай бұрын
Let's say we have 1 billion users, I don't want to generate static page for all the users but only when the user is visiting the page for the first time. Can we add to the userids only when the user visits the page?
@NOTHING-en2ue
@NOTHING-en2ue Жыл бұрын
i finally understand, thanks a lot ❤
@ssatriyaa
@ssatriyaa Жыл бұрын
When we use generatestaticparams, does loading tsx still render? Cuz when I use it in my app loading.tsx does not seem to load right after I click it.
@aksxaay
@aksxaay Жыл бұрын
How is he getting the intellisense for the new revalidate export? I don't seem to have any way to set that up.
@ekimdev7622
@ekimdev7622 10 ай бұрын
What if we have [userId]/anotherSection , [userId]/anotherSection2 , in this case we have 2 children pages under userId, if those pages fetches a data from another api in their page.tsx file(by usind userId), will all children pages also generate html on server in build time?
@asimalqasmi7316
@asimalqasmi7316 Жыл бұрын
It is nice if you cover the state managements in NextJs with prisma in ssr.
@naylord5
@naylord5 Жыл бұрын
I second this!
@joshtriedcoding
@joshtriedcoding Жыл бұрын
Not sure what exactly you mean, mind elaborating?
@asimalqasmi7316
@asimalqasmi7316 Жыл бұрын
I meant using Redux, Xstate or Zustand with NextJs 13 app dir with Prisma. The way to manage the state in the react server components.
@finenode8363
@finenode8363 Жыл бұрын
what if 10,000 users?
@lightoflifegames7227
@lightoflifegames7227 7 ай бұрын
I have some progress bars that show amount of money donated. I need to update ONLY AFTER SOMEONE DONATED. I think this is possible right?
@harrykang4956
@harrykang4956 Жыл бұрын
❤❤thank you for this video
@AmodeusR
@AmodeusR Жыл бұрын
I didn't get the reson for that map, you just made a redundant code, using map in an array of one value to return an array with the same one value.
@drgregoryhouse1470
@drgregoryhouse1470 Жыл бұрын
Can you make an video on how to deploy ISR to AWS-Amplify, I am stuck because SSG works but ISR does not. I don't seem to find any good resources on this topic. If there are, I would be happy about some links :)
@user-yi7rd8gp4k
@user-yi7rd8gp4k Жыл бұрын
Thank you ❤
@jaeken
@jaeken Жыл бұрын
What if your data fetching requires a bearer token (which it often does) that of course changes every hour or so. I guess you cant benefit from this then? 😢
@user-vx7gt8ey5p
@user-vx7gt8ey5p 7 ай бұрын
How does ISR affect SEO?
@seehgom
@seehgom Жыл бұрын
This is great for small size user base
@joshtriedcoding
@joshtriedcoding Жыл бұрын
Next has no problem with that, just becomes a trade-off between build times and UX
@julien_sublaunch
@julien_sublaunch Жыл бұрын
@@joshtriedcoding do you know the build time for 1000 pages as linktree page for example? To have an idea, if NextJs gave some infos about this. Thanks for the value btw!
@darkdeathoriginal
@darkdeathoriginal 10 ай бұрын
can you do this for query params
@soymartiinez
@soymartiinez Жыл бұрын
Now a example 👏 please.
@chrishabgood8900
@chrishabgood8900 Жыл бұрын
Is there a way to push data from the server into the system instead of polling?
@julien_sublaunch
@julien_sublaunch Жыл бұрын
Yes, with revalidate
@marufbepary100
@marufbepary100 Жыл бұрын
I think I done everything correctly but it is not working. This is meant to represent a project object. export default interface Project { name: string; slug: string; description: string; imageURL?: string; imagesList?: string[]; repoURL?: string; siteURL?: string; articleURL?: string; programmingLanguage: string; technologies?: string[]; type: | "Web Dev" | "Extra Web Dev" | "Backend Web Dev" | "Machine Learning" | "Java Assignments" | "Other"; } Each project has its own page with its appropriate metadata. app/projects/[slug] export const generateStaticParams = async () => { // get all projects with metadata const projects = [ ...webdevProjects, ...extraWebDevProjects, ...backendWebDevProjects, ...machineLearningProjects, ...javaAssignments, ...otherProjects, ]; return projects.map((project) => ({ slug: project.slug })); }; interface ProjectPageProps { params: { slug: string; }; } const ProjectPage: React.FC = ({ params }) => { const pathname = usePathname(); // used to determine the current route // const params = useParams(); // retrieve the URL parameters const router = useRouter(); const slug = params.slug; const allProjects: Project[] = [ ...webdevProjects, ...extraWebDevProjects, ...backendWebDevProjects, ...machineLearningProjects, ...javaAssignments, ...otherProjects, ]; const project = getProjectBySlug(slug, allProjects); const projectName = getNameBySlug(slug, allProjects); const projectTechnologies = getTechnologiesBySlug(slug, allProjects); const projectLanguage = getLanguageBySlug(slug, allProjects); const projectDescription = getDescriptionBySlug(slug, allProjects); let gallery = getImagesListBySlug(slug, allProjects); // Adds full path to images if (gallery) { gallery = gallery.map((image) => `/projects/${slug}/${image}`); } // If the project does not exist, redirect to the 404 page if (!project) { router.push("not-found"); }...
@mrfuture3591
@mrfuture3591 Жыл бұрын
video build production nextjs to hosting, please
@nubian_goat
@nubian_goat Жыл бұрын
Yes we need example for this boss. Can you show it how we can connect this with sanity. I want to make blog site
@nubian_goat
@nubian_goat Жыл бұрын
With next auth so users can sign in and post a comment as well
@nubian_goat
@nubian_goat Жыл бұрын
Also with ads components. Thanks
@nubian_goat
@nubian_goat Жыл бұрын
With carousel in the homepage 😅😂
@filipfedorisin3457
@filipfedorisin3457 Жыл бұрын
Is it really best practice to use this for users? Lets just say that you have thousands of users, then you need to cache all of those routes. Seems pretty demanding. I think that to remove latency for userId specific pages the better practice is SSR or even client side fetch as the user does not care much about speed there. I would even say that it is safer. But for high traffic routes like blogs or eshop products etc the ISR would be more appropriate.
@joshtriedcoding
@joshtriedcoding Жыл бұрын
As I said towards the end, it is a trade-off between build time and UX. It also depends on the nature of your dynamic route, whether it handles users, documents, posts ... Lots of factors play into the decision whether to use ISR, SSG or SSR pages
@filipfedorisin3457
@filipfedorisin3457 Жыл бұрын
@@joshtriedcoding Ah yes, next time I will make sure to watch until the end, great videos tho. Could you also make something about rate limiting and throttling for the T3 stack?
@joshtriedcoding
@joshtriedcoding Жыл бұрын
@@filipfedorisin3457 Cheers, good idea
@finenode8363
@finenode8363 Жыл бұрын
What if 10,000 users?
@vaggelis_best
@vaggelis_best 3 ай бұрын
In this case, dynamic generation makes more sense (as he said at the end). I think tha this feature can prove useful for things that are not overly to many & get shown to many users, like the posts of a blog fetched from another website
@جوادجیتی
@جوادجیتی 8 ай бұрын
my nextjs app images not lazy load
@user-ud4bj9vc7l
@user-ud4bj9vc7l 2 ай бұрын
so... what about a real world ?
@universe_decoded797
@universe_decoded797 Жыл бұрын
Put off the nextjs moonboi glasses inmediately, you’re missing out on nuxt3
@TheRealSmexy
@TheRealSmexy Жыл бұрын
do you have discord kind sir?
10 common mistakes with the Next.js App Router
20:37
Vercel
Рет қаралды 212 М.
NextJS 13. Варианты рендеринга - RSC, CSR, SSR, SSG, ISR
26:31
Михаил Непомнящий
Рет қаралды 28 М.
哈莉奎因怎么变骷髅了#小丑 #shorts
00:19
好人小丑
Рет қаралды 32 МЛН
WORLD BEST MAGIC SECRETS
00:50
MasomkaMagic
Рет қаралды 34 МЛН
나랑 아빠가 아이스크림 먹을 때
00:15
진영민yeongmin
Рет қаралды 18 МЛН
The Better Way to Load Images
8:46
Josh tried coding
Рет қаралды 46 М.
What is CSR SSR SSG and ISR
16:57
Hitesh Choudhary
Рет қаралды 55 М.
Fetching Data Doesn't Get Better Than This
6:58
Josh tried coding
Рет қаралды 116 М.
What is Incremental Static Regeneration? (ISR)
8:31
leerob
Рет қаралды 16 М.
How Did I Not Know About These React Hooks Before?
13:48
Josh tried coding
Рет қаралды 31 М.
Don't Make These Next.js Mistakes
13:01
Dave Gray
Рет қаралды 22 М.
The ultimate guide to web performance
6:43
Beyond Fireship
Рет қаралды 430 М.
The Problem With UUIDs
6:36
Josh tried coding
Рет қаралды 73 М.
哈莉奎因怎么变骷髅了#小丑 #shorts
00:19
好人小丑
Рет қаралды 32 МЛН