Тёмный
No video :(

Next.js 13 Changed Data Fetching and Rendering... But Is It Good? 

CodeSnaps
Подписаться 1,4 тыс.
Просмотров 7 тыс.
50% 1

Опубликовано:

 

5 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 42   
@Diego_Cabrera
@Diego_Cabrera Год назад
Hands down the most comprehensive next js video on this topic. Keep up the amazing content!
@CodeSnaps
@CodeSnaps Год назад
Wow, thanks! I really appreciate that :)
@ahmedkhalid-ld1ex
@ahmedkhalid-ld1ex 10 месяцев назад
This video should be popping off.. best next13 features explanation out there .. great job, buddy.
@CodeSnaps
@CodeSnaps 10 месяцев назад
Wow, thanks!
@user-et2ip6cu8e
@user-et2ip6cu8e 5 месяцев назад
that's amazing video on next js Data Fetching and comparison between next 12 vs 13. well done. Thank you for sharing your knowledge on such a this simple and easy way
@unhandledexception1948
@unhandledexception1948 11 месяцев назад
Best explanation of v13 changes to rendering / data fetching I've found. Please more NextJs videos :-)
@CodeSnaps
@CodeSnaps 11 месяцев назад
Thanks, will do! More will come :)
@gorkxs
@gorkxs Год назад
The best NextJs video I have seen. Thank you
@CodeSnaps
@CodeSnaps 11 месяцев назад
Thank you, I'd appreciate that a lot :)
@ahmedjaber8595
@ahmedjaber8595 10 месяцев назад
im still learning nextjs your video looks interesting saved to "watch later" thanks
@malamhari_
@malamhari_ Год назад
Using Vue currently, I'm very sure your videos will help me catch up with NextJS next time I return to using it, thanks!
@CodeSnaps
@CodeSnaps Год назад
Sounds great! Glad it was helpful :)
@shivanisehgal7545
@shivanisehgal7545 5 месяцев назад
Very helpful explanation !! Is there a way to mimic getInitialProps in next 13?
@anhtuanle4991
@anhtuanle4991 10 месяцев назад
Thank u so much, knowledge base is useful
@CodeSnaps
@CodeSnaps 10 месяцев назад
Glad to hear that!
@didarnawzad
@didarnawzad Год назад
Well done, very clear explanation
@CodeSnaps
@CodeSnaps Год назад
Thanks, glad you liked it :)
@bogdanalexandru5071
@bogdanalexandru5071 11 месяцев назад
Fantastic video explaining these confusing differences! Question regarding ISG in Next.js 13 with static paths: so you can add the revalidate parameter to the fetch call in getPost, and this makes sure that any update to a particular post gets rebuilt, but what about the fetch call inside the generateStaticParams? Would that also need a revalidate param in order to make sure that after adding a new post to the list, its id gets added to the static list of paths?
@CodeSnaps
@CodeSnaps 11 месяцев назад
When you update a post from your database or through a CMS, generateStaticParams is not called again. By default, dynamic segments not included in generateStaticParams are generated on demand. This means that the data is also cached. You can disable this by exporting "export const dynamicParams = false" in your page.js, layout.js or route.js file. It's set to true by default. Exporting it to false will return 404 for posts that were not generated statically at build time. So it's best to leave it set to true and not export it. This will eliminate the need to rebuild your site, which is the only way to call generateStaticParams again. To show the updated version of your post, you can use time or on-demand revalidation. Time revalidation is as simple as adding the revalidate option to your fetch function like this "fetch('...', { next: { revalidate: 3600 } })". The value is in milliseconds. On-demand revalidation can be done by path (revalidatePath) or by cache tag (revalidateTag) inside a route handler or server action. Here's it's best to check the docs for implementation, but one example would be to use webhooks if you use a CMS and call the route handler to revalidate the path. generateStaticParams works like getStaticPaths, so you could look for how revalidation was implemented with getStaticPaths to get an idea of a good workflow. Hope this helps :)
@bogdanalexandru5071
@bogdanalexandru5071 11 месяцев назад
@@CodeSnaps Thanks for the comprehensive response! In the second paragraph, you are discussing the revalidation parameter for the getPost function, but what about the fetch call from the generateStaticParams? Does that support the revalidate param as well with the same effect? (i.e., rebuild the static paths every N seconds)
@paulmothapo
@paulmothapo 10 месяцев назад
Thank you❤️🔥
@CodeSnaps
@CodeSnaps 10 месяцев назад
Any time :)
@trinizone1
@trinizone1 Год назад
This was awesome!!
@CodeSnaps
@CodeSnaps Год назад
Thank you :)
@trinizone1
@trinizone1 Год назад
No seriously, i'm working on a project right now and as a "beginner" this was probably one of the best videos i've seen in my research. I actually saved it. I would love to have you check out my project!@@CodeSnaps
@sheikhtahamaroof8484
@sheikhtahamaroof8484 11 месяцев назад
Hey man, that was a great and very informative explanation, but I wondered can we cache the request time data like can we cache the data sent from the server so may be we can have faster performance and also just changing the cache option we are changing whether the site is rendered on build time (just once) or page is served from the server or request time(on every page request), right?
@CodeSnaps
@CodeSnaps 11 месяцев назад
I hope I understood your questions correctly. The data that is fetched from the server is automatically cached, even with revalidation, because it shows the cached data first, and after revalidation it sets a new cache. The data is cached once at build time, but if you add revalidation with something like "fetch('...', { next: { revalidate: 3600 } })", then the data is cached again after revalidation. This means that we always have better performance because the data is fetched from the server and cached. If you use something like "fetch('...', { cache: 'no-store' })", then the data is not cached, but fetched on every single request. Just using fetch alone with no other options (default) will automatically cache it once per build time. It won't fetch it again, you need to revalidate for that. Hope that helps!
@abhishekchandel4244
@abhishekchandel4244 5 месяцев назад
appreciate the quality of the content
@shahreazneeloy2119
@shahreazneeloy2119 Год назад
Very informative
@CodeSnaps
@CodeSnaps Год назад
Thanks! Glad you liked it :)
@anhvuuc8693
@anhvuuc8693 11 месяцев назад
Great videos, thank you! Can you make video how to do a list products page which has "Load more" button, I don't know what is the best way to do that with Nextjs 13, I don't really want to use client component?
@CodeSnaps
@CodeSnaps 11 месяцев назад
Sure, but if you want to fetch more todos in a todo list, you'll need to use a client component. However, the first, let's say 20 todos can be fetched via the server using server components. Then when the user clicks "Load more", you use a client component to show more todos. This way you can use both server components and client components at the same time.
@dios8256
@dios8256 8 месяцев назад
This is great
@davidirawan3083
@davidirawan3083 11 месяцев назад
this is awesome!. I want to ask, is generateStaticParams function revalidate on new data? or we should add params next{revalidate} on function enerateStaticParams ?
@CodeSnaps
@CodeSnaps 11 месяцев назад
Thank you very much! So generateStaticParams doesn't revalidate for new data. However, you can add 'next: { revalidate: X }' to the fetch function where, for example, you fetch a single post, not to the fetch function inside generateStaticParams. So add 'fetch(URL, { next: { revalidate: 3600 } })' to getPost() and not inside generateStaticParams(). This only works with the native fetch function. If you are using libraries like axios, then add 'export const revalidate = X' somewhere on the page where you call generateStaticParams. Hope this helps!
@davidirawan3083
@davidirawan3083 11 месяцев назад
@@CodeSnaps Oh I see,thank You so much. I just know the export const revalidate = X for another fecthing data like axios.Its very clear with this explanation.Thanks brother👍
@chi-mf1cx
@chi-mf1cx Год назад
Amazing content brooo...
@CodeSnaps
@CodeSnaps Год назад
Thank you so much :)
@NyxAnderson
@NyxAnderson Год назад
Can you do a video on React Query in Next 13+ thank you!
@CodeSnaps
@CodeSnaps 11 месяцев назад
Sure thing! It's a good idea, thanks :)
@ProWichDoctor
@ProWichDoctor 11 месяцев назад
If I'm not mistaken we have no possibility to use react query inside the server component we can use it if we add "use client'' on the top of the page component. Will be great to have the possibility to use react query inside server page component(. Because it's very sad to use native fetch we will have no isLoading, isError and etc...
Далее
Moto Trial vs Moto acrobática 🏁
00:29
Просмотров 2,3 млн
10 common mistakes with the Next.js App Router
20:37
Просмотров 209 тыс.
What Theo Won't Tell You About Next.js
8:37
Просмотров 88 тыс.
5 Reasons To Use Next.js Over Plain React
14:50
Просмотров 36 тыс.
Next.js 13 Data Fetching - The Ultimate Guide
40:07
Просмотров 39 тыс.
Incrementally adopt the Next.js App Router
16:21
Просмотров 44 тыс.
Next.js App Router: Routing, Data Fetching, Caching
14:32
Moto Trial vs Moto acrobática 🏁
00:29
Просмотров 2,3 млн