Next.js App Router: Routing, Data Fetching, Caching

  Рет қаралды 332,252

Vercel

Vercel

Күн бұрын

Пікірлер
@NobleOsinachi
@NobleOsinachi Жыл бұрын
Bro just explained half of my Next JS problems in 15 mins! Wow! This guy is good! 👍👍👍
@ڈاکٹرمحمدکامرانعبدالّٰله
@ڈاکٹرمحمدکامرانعبدالّٰله 5 ай бұрын
beacuse it is by next js original channel
@stillready6405
@stillready6405 Жыл бұрын
I didn't know you have a KZbin channel. I was trying for hours, reading the documentation and failed. And here you explain everything in just 15 minutes. Thank you for the video!
@Vextor007998
@Vextor007998 Жыл бұрын
This guide really answered almost all of my questions, it's short and straightforward. You're doing a great job.
@NobleOsinachi
@NobleOsinachi Жыл бұрын
Same thing I said. Like it was really packed with information and yet short.
@badalsaibo
@badalsaibo Жыл бұрын
This was an excellent demo. Concise, brief and to the point. Thanks Lee!
@leerob
@leerob Жыл бұрын
Thank you, this made my day 😁
@advem.
@advem. Жыл бұрын
Light years ago music was on vinyl records, then on CDs and now it's streamed from cloud. Movies were on VHS, later DVDs and BlueRays - now it's streamed from cloud. Video games... can't ever remember all those consoles but now it's all digital and also you can stream playing in cloud. Finally webApps - your UI had been rendering on your device's broweser for days or rendered server-side... ...until now. It's time for streaming era even in webdev with UI Streaming! Simply render component, cache or revalidate it and serve to clients! Just this tiny piece! FINALLY I am sooooo hyped for the stable release you can't image. Love what u doing guys
@ryanp787
@ryanp787 Жыл бұрын
Love NextJS!!! Y’all are doing amazing innovative changes and I can’t wait for the app folder to be in production!! I’m hopping it’s coming in the near future. Keep up the great work team!!
@wij8044
@wij8044 Жыл бұрын
Literally, the only thing new was the last stuff with Metadata
@SheeceGardazi
@SheeceGardazi Жыл бұрын
nothhing innovate ... it has been part of nuxt.js since for ever ...
@kyonas6047
@kyonas6047 Жыл бұрын
Its now stable!! Horray just as i got back to next js
@tabletuser123
@tabletuser123 Жыл бұрын
Ai generated comment
@ryanp787
@ryanp787 Жыл бұрын
@@tabletuser123 nope I’m real lol. Your account name looks AI generated
@tomasburian6550
@tomasburian6550 Ай бұрын
Love how you're using TS along with the code. That's real world coding.
@BenZekriNBENZ
@BenZekriNBENZ Жыл бұрын
Thanks Nextjs team, you're making the world of dev a better place and without headache.
@depression_plusplus6120
@depression_plusplus6120 Жыл бұрын
How do you manage localstorage in next. As we can't access it since next prerenders on server, right?
@BenZekriNBENZ
@BenZekriNBENZ Жыл бұрын
use LocalStorage in a client component 'use client'@@depression_plusplus6120
@mohitnagpal
@mohitnagpal Жыл бұрын
I love Next.Js. Keep on going guys.
@leerob
@leerob Жыл бұрын
Thank you!
@browsing1598
@browsing1598 6 ай бұрын
Dude you legit saved me. Was spending so much time on this. This is the only video that helped me
@youneshenni5417
@youneshenni5417 Жыл бұрын
This is the future of Web Developement!!!!
@AdeelEjaz
@AdeelEjaz Жыл бұрын
I have been using app router for a few months on few of my production projects, and very impressed with the results. I'd love to see videos on how to implement GTM/GA, and posting data e.g. updating user details in a form.
@leerob
@leerob Жыл бұрын
Great suggestions!
@aneriemmanuel7243
@aneriemmanuel7243 Жыл бұрын
Yeah this would be great, seems work on mutations is still ongoing for now…. But it seems the app directory is reaching stable, started a new SAAS project with it and hopefully it doesn’t end in tears 😂
@epzoid7273
@epzoid7273 Жыл бұрын
thank you so much for this video, i am new to nextjs and i know noone that knows nextjs 13, so they couldnt help me with a problem i got with routing. but then you came!
@GowthamN-sp9wc
@GowthamN-sp9wc 11 ай бұрын
Thank you for the info on how to route one page to another without a link tag.
@appscastle
@appscastle 7 ай бұрын
This guy should keep posting videos, the examples and the way he explain things are just amazing
@tanmaysharma4043
@tanmaysharma4043 Жыл бұрын
Full stack industry level application tutorial needed for all the best practices and application
@codinginflow
@codinginflow Жыл бұрын
Once the remaining router bugs are fixed, this will be amazing
@Mitsunee_
@Mitsunee_ Жыл бұрын
this video basically just combines all the previous ones and answered none of the questions I still have: - what kinds of metadata can you set with this new approach? What about custom metadata tags? - how exactly do you deduplicate fetches with cache set to "no-store" - how exactly do you extend the types of `fetch`? Will it mess up client components that use fetch in a useEffect? Do the changes apply outside of the app directory? - Do I always need to include "use client" at the top of every file in my entire repo forever or only specifically on the client components inside the app directory? - Can I create a folder of shared server components inside the app directory (assuming you cannot use server components elsewhere, see above question) and simply have no page.tsx in there, so no route is created, or will Next complain at the lack of a page.tsx file? - Does anything change for components that use something like typeof document to determine whether they are running in server/hydration or client (post-hydration)? - How do you pass data from a page to a layout? In Astro you import layouts yourself and thus can pass "up" data to the layout in your jsx template - How do you access the router object in a layout since useRouter won't work in server components? Do I still need my navigation to be a client component just so I can render the current route in a different style? - In addition to above question: what about something like rehype-react (assuming I do not want mdx and prefer my own implementation using unified), which currently uses hooks to render? I made it work in the old pages directory API by returning the result prop of the processSync method on my renderer, but currently this reprocesses the entire post during hydration. Is it possible to use the renderer in the server only and have client components inside the result (such as a youtube embed)? - Do you still plan to eventually remove the pages directory API entirely? My biggest project is currently going through a big rewrite that still uses that API and if I have to rewrite it all again I may or may not switch frameworks at that point, depending on if this app directory API works out for me in the end, which I am currently not sure about.
@reesebearden6566
@reesebearden6566 Жыл бұрын
used nextjs in my senior capstone project, it's blowing everyone away!
@christopheanfry2425
@christopheanfry2425 Жыл бұрын
Love it make me want to use nextjs every single day. You’re an amazing team with an amazing product. Huge kudos for all of you and a special thank to you Lee for your videos
@leerob
@leerob Жыл бұрын
Appreciate the kind words :)
@Paul_Aderoju
@Paul_Aderoju Жыл бұрын
Currently using this in my next project and it’s so much easier to route between pages
@liketocode
@liketocode Жыл бұрын
Wow, never been so happy to be told I have to re-write my code base ... what's NEXT ;) 1) As has been asked below, how do we now define a list of paths for prerendering - previously done using getStaticPaths Method? The docs do not seem to detail this specifically? 2) Observation - the generic naming convention for Page and API routes will make searching for files during development a bit of a task? Thanks a million - super framework.
@grmn3564
@grmn3564 Жыл бұрын
I'm learning NextJS at the moment and I have the same question about the generic naming convention. I opted for the old routing system because I want each file to have a more descriptive name. I'm still trying to understand the advantages of the new routing system, so if anybody can explain, please do it! thank you :)
@2an_sound
@2an_sound Жыл бұрын
Thank you! I'm not an expert in NextJS and in their docs for app router, couldn't find any mention of utilizing params to get the id from a dynamic route. I was messing with headers, pathname etc when params would have been fine. You helped me so much. Now I'm just trying to figure out why pages in my dynamic routes don't use the root layout (the page itself takes over the whole screen and the root layout is gone)
@franksonjohnson
@franksonjohnson Жыл бұрын
Next finally cracking Jekyll's layout feature 13 years later. But good demo of the data fetching behavior from Lee!
@harshilpatel3389
@harshilpatel3389 Жыл бұрын
Finally i get the solution of routing. Huh. Please mention this specifically clear in the your website.
@faizanahmed9304
@faizanahmed9304 Жыл бұрын
Thank you team vercel for explaining the concepts!
@leerob
@leerob Жыл бұрын
Thank *you*!
@faizanahmed9304
@faizanahmed9304 Жыл бұрын
@@leerob you're welcome
@kasper369
@kasper369 Жыл бұрын
Please make a video on, Deployment. How to optimize and the proper way to deploy your app for the wild in new nextjs 13 way
@mohamedheythembenhassen8337
@mohamedheythembenhassen8337 Жыл бұрын
Thank you so much vercel and @leerob , very short and informative video , i really like the app directory .
@adimardev1550
@adimardev1550 Жыл бұрын
i admit, this is truly fantastic! thanks to you amazing people of vercel and to you Lee, you're awesome. i'd love to know more to understand fully...
@devkasunlakshitha
@devkasunlakshitha Жыл бұрын
Love these new improvements. This is why I love Next JS ❤
@victorekea
@victorekea Жыл бұрын
This is a great refresher and summary of all the awesome features of the nextjs app directory. I'm curious if there are any implications of setting the cache: no-store parameter on the fetch keyword.
@exprove2496
@exprove2496 Жыл бұрын
In 13:35 it's mentioned that "these are automatically deduplicated". If in getRepo was passed fetch({ cache: no-store }) would generateMetadata and Page make only one or two requests each refresh?
@tilmanmarquart8744
@tilmanmarquart8744 Жыл бұрын
Super excited to use this in prod soon!😁
@RedVelocityTV
@RedVelocityTV Жыл бұрын
I'd love to see a state management video for Next13. How server data can be hydrated on client to add interaction
@zuma206
@zuma206 Жыл бұрын
just pass props to a client component, that simple :)
@RedVelocityTV
@RedVelocityTV Жыл бұрын
@@zuma206 large apps don't use prop drilling. They have their own client store
@random4561
@random4561 Жыл бұрын
@@RedVelocityTV I think you would just pass the props to the layout where it can hydrate the client store, just like with the current pages system
@najlepszyinformatyk1661
@najlepszyinformatyk1661 Жыл бұрын
usually, you don't need to think about state management in an old-fashioned way, now all requests are cached by default so you just need to create the function `fetchSomeShit` and reuse it. For a client-based state, you can use old approaches as well
@DrDarp
@DrDarp Жыл бұрын
For everyone wondering what icon pack it is, it's vscode-icons
@sreeharsharaveendra289
@sreeharsharaveendra289 4 ай бұрын
This is the best video I found for app router! Screw all the wanna be copycats, Lee ur awesome!
@FrontendMedia
@FrontendMedia Жыл бұрын
Thanks! Those new features are really neat.
@farzadali7434
@farzadali7434 7 ай бұрын
Excellent delivery!
@emeraudata
@emeraudata 5 ай бұрын
You just have save my project before I turn crazy, tx comrade
@timeforrice
@timeforrice Жыл бұрын
Very helpful!! Hope to see more videos like this!!
@wfl-junior
@wfl-junior Жыл бұрын
I can't wait to use the app directory stable
@iwantfrens5804
@iwantfrens5804 11 ай бұрын
Leerob is fcking amazing!!! I love these videos!!!
@syedhaider0916
@syedhaider0916 Жыл бұрын
I wish you had kept going on and on explaining next js like sliding knife in butter.
@olraclem
@olraclem Жыл бұрын
very well explained! just wow
@redhood7105
@redhood7105 Жыл бұрын
Video about auth with new Next would be nice. How to protect routes and such
@Tantewillieja
@Tantewillieja Жыл бұрын
Love the app directory, made my life so much easier!
@leerob
@leerob Жыл бұрын
Glad to hear it!
@idanmasas
@idanmasas Жыл бұрын
@@leerob Hey Lee, can you please share with us the VSCode theme that you were using during this video?
@versaleyoutubevanced8647
@versaleyoutubevanced8647 Жыл бұрын
very straightforward, love it
@yukikaze-vn7ek
@yukikaze-vn7ek 24 күн бұрын
Start learning Next from App router is much more easy now😀
@nayyyhaa
@nayyyhaa Жыл бұрын
this is BEAUTIFUL!!!!!
@fredericorinco9133
@fredericorinco9133 Жыл бұрын
The big thing here is being able to import npm packages like embedded tweets, unsplash images, etc, that do their own fetching on the server. The bad side is that the nesting is incredibly quirky, and waterfall-prone. If there's not enough education on the subject, the level of apps will reduce, and the number of new apps passing the performance criteria will reduce dramatically. The architecture allows for bad fetching. But well so does react-query, apollo client and friends.
@th0mas.p4ttz
@th0mas.p4ttz Жыл бұрын
Brilliant innovations!
@iAmTheWagon
@iAmTheWagon Жыл бұрын
Yes. This is very helpful. Thank you.
@jsricochet
@jsricochet Жыл бұрын
Clear and to the point: thanks!
@4dev346
@4dev346 Жыл бұрын
7:55 How can I pass the data from root layout to the children.
@wouterdeen
@wouterdeen Жыл бұрын
Extremely helpful video, thank you!
@TheDoguBati
@TheDoguBati Жыл бұрын
Can i just ask how do i generateStaticParams using prisma. Because for some reason i always get undefined instead of receiving array of ids and generates a type error when i try next/build
@ssawass
@ssawass Жыл бұрын
Not sure why Route Handlers were not showcased here. Seemed like a fitting topic
@AllanLeonardJr
@AllanLeonardJr Жыл бұрын
Just what I needed, awesome!
@kasper369
@kasper369 Жыл бұрын
Amazing stuff ❤
@andriidoroshenko632
@andriidoroshenko632 Жыл бұрын
What's the color scheme?)
@ooogabooga5111
@ooogabooga5111 Жыл бұрын
Please also talk about how to share data between all these components with data being cashed on server, How to add styles. If there are any gotcha as it stands right now.
@FelipeSantos92Dev
@FelipeSantos92Dev Жыл бұрын
Like you said...it really blows my mind 😅 #Amazing
@Moh_ha
@Moh_ha Жыл бұрын
Amazing great work!
@Gyurmatag
@Gyurmatag Жыл бұрын
What If I have some dynamic data on one route and I navigate to another route where I add to that data with a post request (for example a blog post) and If I navigate back to the previous route (without refresh) I want to see the fresh data list (post list) with the new item added? What can I use it to invalidate the cache and make Next.js to call the fetch again without refresh?
@Ruffi0
@Ruffi0 Жыл бұрын
I prefer nuxt. But yes this is the way. Strapi is one of my favs. Headless WP isnt anything to scoff at though. There are frameworks that exist solely for headless WP and with its extensions of plugins.
@kasvith
@kasvith Жыл бұрын
Whats the best way to handle Auth and Pass state from server to client
@allyk904
@allyk904 Жыл бұрын
İt s been incredible helpfull. Thanks
@anuragkothare6181
@anuragkothare6181 Жыл бұрын
VS Code Theme name?
@quickclean-ninja
@quickclean-ninja Жыл бұрын
Great thanks..finaly i got it
@oiojin831
@oiojin831 Жыл бұрын
clear explanation
@Blu3yo
@Blu3yo Жыл бұрын
I love using the new app folder just need auth0 to update their next library for handling server side authentication. Currently it’s using the old router.
@Steffi3rd
@Steffi3rd Жыл бұрын
Awesome!!! Just have a question about generateMetaData : We need to do a getRepo twice (inside component and generateMetaData) I think it's a shame that we can't make this call only once to reuse the response of the getRepo in component for the generateMetaData... Isn't there another way to make a single network call? Thanks!
@TwistedChaz
@TwistedChaz Жыл бұрын
Bingo! at least would take data from the Page params
@predaytor
@predaytor Жыл бұрын
What’s icon pack is this? Vscodd
@peterlee8407
@peterlee8407 Жыл бұрын
Nice video! Could I know why every time when you type new lines of code, the "code hints" in grey colors already know what you are going to type? Any plugins abt this? Thx
@prateekbagrecha7012
@prateekbagrecha7012 Жыл бұрын
Could you please tell us the extensions that you are using to speed the development ?
@GuillaumeDuhan1
@GuillaumeDuhan1 Жыл бұрын
Thanks for this amazing video
@Paul_Aderoju
@Paul_Aderoju Жыл бұрын
Please do a video on NextJS SEO
@codinginflow
@codinginflow Жыл бұрын
Is there a difference between no-cache, no-store and next.revalidate: 0?
@nirjoyhasanantor3149
@nirjoyhasanantor3149 Жыл бұрын
I am really excited for this update but here is a suggestion/question how can we access req/context like we did in getServerSideProps for ex: context.req/res how can we do that in new app directory I hope this all gets added if not exists and if anyone reading this can anyone tell me which theme was he using it is good
@JustATempest
@JustATempest Жыл бұрын
You can access requests by accepting a request as an argument to the page function.
@nirjoyhasanantor3149
@nirjoyhasanantor3149 Жыл бұрын
@@JustATempest Thanks For The Reply But Can You Actually Tell Me How Can I Do That?
@MohitSharma-rz1uq
@MohitSharma-rz1uq Жыл бұрын
hey i am new so i have a simple question....after next13.4 we cannot use getServerSideProps in the latest versions? we have to do it like we usually do inside the component without defining additional function right???
@nirjoyhasanantor3149
@nirjoyhasanantor3149 Жыл бұрын
​@@MohitSharma-rz1uqYes you can define a component as a client by using "use client" in 1st line of the component
@Ga2-20
@Ga2-20 Жыл бұрын
What is the optimized approach for implementing Material UI in Next v13 ? :)
@Chiny_w_Pigulce
@Chiny_w_Pigulce Жыл бұрын
The optimized approach would be to not implement Material UI ;)
@Ga2-20
@Ga2-20 Жыл бұрын
@@Chiny_w_Pigulce what if you have large app built with MUI5 in next 12 and want to migrate to version 13
@abdulramonlasisi3385
@abdulramonlasisi3385 Жыл бұрын
I think you can extract the provider context into a wrapper component and wrap the root layout with it
@trevortylerlee
@trevortylerlee Жыл бұрын
Had an issue where halfway through development we needed a page that we did not want to use the root layout. Seems like the only way to do that is to split that one page and the rest of the site into two separate folders in the app directory, each with their own layout. Tried doing that but as a result all my imports / paths broke. Is there an easier way to go about creating different root layouts? Or opting out of a root layout?
@ooogabooga5111
@ooogabooga5111 Жыл бұрын
I have been thinking the same, on how to out out of a certain layout for a specific page that is deeply nested. Like I would like to have root: layout work and layout level 2 work but I don't want layout level 1 to be included in the same route. Like how do I avoid that. Right Now The only way of doing it seems to be, not using layouts and instead use it as components that you can import like how we did it in the old nextjs.
@sumitsaha6941
@sumitsaha6941 8 ай бұрын
Keep going sir.
@michalstrnad7685
@michalstrnad7685 Жыл бұрын
Honestly I liked the pages directory more. I can't even imagine how we are going to refactor our entire website for the app router. Tried using it on my own and had multiple "wtf" moments. For example why you can't export anything except async functions from a component file if its a server side component? Like an enumeration for example. Or maybe some constant that is relevant to the component but can be used elsewhere. Makes no sense to me. Pages were much more flexible and did not throw errors at you all the time.
@vinayak2450
@vinayak2450 Жыл бұрын
How would the app know how many ISR pages it has to store it statically first at build time?
@adeleke5140
@adeleke5140 Жыл бұрын
Thank you for this video. It is so informative. I have one question for Lee, how does he get his cursor to move so smoothly?
@developerpaul46
@developerpaul46 Жыл бұрын
Thanks Lee
@sthomastt
@sthomastt Жыл бұрын
Excellent to the point(s) video. Is there a code repo with the examples, so I can save time remixing and experimenting?
@thedigitalceo
@thedigitalceo Жыл бұрын
I’m a NextJS fanboy 🎉
@shubhchaudhary6562
@shubhchaudhary6562 Жыл бұрын
Anybody know which icon pack hee is using?
@killiankavanagh3854
@killiankavanagh3854 Жыл бұрын
very helpful
@JakubGaniaSoftware
@JakubGaniaSoftware Жыл бұрын
My next bigger project will be with Next.js.
@AbdulMajeed-lf5sq
@AbdulMajeed-lf5sq Жыл бұрын
using the next/link within mapping function gives hydration error. I think this is a very common issue now.. please fix it in the next update
@Ga2-20
@Ga2-20 Жыл бұрын
Can I load data in layout.tsx and pass some of the data as a props to page.tsx which is layout children?
@alcatoo
@alcatoo Жыл бұрын
Waiting too much for stable app folder. Almost changing framework...
@ChungNguyễn-g6c
@ChungNguyễn-g6c 9 ай бұрын
Thanks for sharing! I am confusing what different between images in source code and in public folder (performance, bundle size, ... ) and what is the best practice?
@mahdimohammed5393
@mahdimohammed5393 Жыл бұрын
Great video When the app folder will be stable do you know the date ?
@FrontendMedia
@FrontendMedia Жыл бұрын
Hi, thanks for tutorial! What icon theme are you using here? :)
@ivgadev
@ivgadev Жыл бұрын
This is cool but how can we use middleware inside the app dir folder? Is this already developed? I am using one on the root but I need more for my app. Thank you.
@leerob
@leerob Жыл бұрын
Middleware is supported!
@brahimo4701
@brahimo4701 9 ай бұрын
is there a way to combine between getting the data from a server component and the use of "use hook" on the client component to avoid passing props??
@TJMcCarty
@TJMcCarty Жыл бұрын
In production, in my "use client"; components, the data is cached and won't revalidate even if I follow the instructions in this video. Very annoying. How would I not cache the data in a client side component?
10 common mistakes with the Next.js App Router
20:37
Vercel
Рет қаралды 230 М.
Next.js App Router Caching: Explained!
25:22
Vercel
Рет қаралды 103 М.
Симбу закрыли дома?! 🔒 #симба #симбочка #арти
00:41
Симбочка Пимпочка
Рет қаралды 4,8 МЛН
Players vs Pitch 🤯
00:26
LE FOOT EN VIDÉO
Рет қаралды 136 МЛН
Why no RONALDO?! 🤔⚽️
00:28
Celine Dept
Рет қаралды 74 МЛН
Next.js Data Fetching, Dynamic Routes & Metadata | Nextjs 13
43:08
Let's Build an AI Saas from Scratch - Ep.1 Basic Setup
37:11
Quinn Eschenbach
Рет қаралды 225
What are my thoughts on next.js app router vs pages router
11:04
Web Dev Cody
Рет қаралды 24 М.
Fetching Data Doesn't Get Better Than This
6:58
Josh tried coding
Рет қаралды 135 М.
Learn Next.js Parallel Routes In 16 Minutes
16:18
Web Dev Simplified
Рет қаралды 138 М.
Build anything with v0 (3D games, interactive apps)
9:05
Vercel
Рет қаралды 130 М.
Incrementally adopt the Next.js App Router
16:21
leerob
Рет қаралды 47 М.
It's finally out!!! (Next.js 15 breakdown)
30:06
Theo - t3․gg
Рет қаралды 89 М.
Симбу закрыли дома?! 🔒 #симба #симбочка #арти
00:41
Симбочка Пимпочка
Рет қаралды 4,8 МЛН