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

  Рет қаралды 283,536

Vercel

Vercel

Күн бұрын

@leerob, VP of Developer Experience at Vercel, explains new concepts and foundations of Next.js app router, including layouts, dynamic routes, and data fetching. Deploy today: vercel.fyi/app-router
⌛️ Timestamps:
0:00 Introduction
0:10 Routing
2:57 Dynamic route segments
4:53 Data fetching
7:36 Caching
11:42 Metadata
💻 Resources:
◆ Routing: nextjs.org/docs/app/building-...
◆ Caching: nextjs.org/docs/app/building-...
◆ Metadata: nextjs.org/docs/app/building-...
#vercel #nextjs

Пікірлер: 305
@NobleOsinachi
@NobleOsinachi 7 ай бұрын
Bro just explained half of my Next JS problems in 15 mins! Wow! This guy is good! 👍👍👍
@epzoid7273
@epzoid7273 11 ай бұрын
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!
@devkasunlakshitha
@devkasunlakshitha Жыл бұрын
Love these new improvements. This is why I love Next JS ❤
@badalsaibo
@badalsaibo Жыл бұрын
This was an excellent demo. Concise, brief and to the point. Thanks Lee!
@leerob
@leerob Жыл бұрын
Thank you, this made my day 😁
@stillready6405
@stillready6405 9 ай бұрын
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!
@mohamedheythembenhassen8337
@mohamedheythembenhassen8337 Жыл бұрын
Thank you so much vercel and @leerob , very short and informative video , i really like the app directory .
@adimardev1550
@adimardev1550 11 ай бұрын
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...
@appscastle
@appscastle 28 күн бұрын
This guy should keep posting videos, the examples and the way he explain things are just amazing
@Paul_Aderoju
@Paul_Aderoju Жыл бұрын
Currently using this in my next project and it’s so much easier to route between pages
@reesebearden6566
@reesebearden6566 Жыл бұрын
used nextjs in my senior capstone project, it's blowing everyone away!
@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 6 ай бұрын
Ai generated comment
@ryanp787
@ryanp787 6 ай бұрын
@@tabletuser123 nope I’m real lol. Your account name looks AI generated
@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 :)
@timeforrice
@timeforrice Жыл бұрын
Very helpful!! Hope to see more videos like this!!
@Vextor007998
@Vextor007998 8 ай бұрын
This guide really answered almost all of my questions, it's short and straightforward. You're doing a great job.
@NobleOsinachi
@NobleOsinachi 7 ай бұрын
Same thing I said. Like it was really packed with information and yet short.
@FrontendMedia
@FrontendMedia 10 ай бұрын
Thanks! Those new features are really neat.
@versaleyoutubevanced8647
@versaleyoutubevanced8647 Жыл бұрын
very straightforward, love it
@2an_sound
@2an_sound 10 ай бұрын
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)
@GowthamN-sp9wc
@GowthamN-sp9wc 4 ай бұрын
Thank you for the info on how to route one page to another without a link tag.
@victorekea
@victorekea 8 ай бұрын
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.
@jsricochet
@jsricochet Жыл бұрын
Clear and to the point: thanks!
@wouterdeen
@wouterdeen Жыл бұрын
Extremely helpful video, thank you!
@tilmanmarquart8744
@tilmanmarquart8744 Жыл бұрын
Super excited to use this in prod soon!😁
@farzadali7434
@farzadali7434 18 күн бұрын
Excellent delivery!
@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
@mohitnagpal
@mohitnagpal Жыл бұрын
I love Next.Js. Keep on going guys.
@leerob
@leerob Жыл бұрын
Thank you!
@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 😂
@iAmTheWagon
@iAmTheWagon Жыл бұрын
Yes. This is very helpful. Thank you.
@AllanLeonardJr
@AllanLeonardJr Жыл бұрын
Just what I needed, awesome!
@mel_alejandrino
@mel_alejandrino 6 ай бұрын
very well explained! just wow
@kasper369
@kasper369 Жыл бұрын
Amazing stuff ❤
@thomaspattinson3977
@thomaspattinson3977 Жыл бұрын
Brilliant innovations!
@nayyyhaa
@nayyyhaa Жыл бұрын
this is BEAUTIFUL!!!!!
@franksonjohnson
@franksonjohnson Жыл бұрын
Next finally cracking Jekyll's layout feature 13 years later. But good demo of the data fetching behavior from Lee!
@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?
@Tantewillieja
@Tantewillieja Жыл бұрын
Love the app directory, made my life so much easier!
@leerob
@leerob Жыл бұрын
Glad to hear it!
@idanmasas
@idanmasas 11 ай бұрын
@@leerob Hey Lee, can you please share with us the VSCode theme that you were using during this video?
@adeleke5140
@adeleke5140 9 ай бұрын
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?
@faizanahmed9304
@faizanahmed9304 Жыл бұрын
Thank you team vercel for explaining the concepts!
@leerob
@leerob Жыл бұрын
Thank *you*!
@faizanahmed9304
@faizanahmed9304 Жыл бұрын
@@leerob you're welcome
@tanmaysharma4043
@tanmaysharma4043 Жыл бұрын
Full stack industry level application tutorial needed for all the best practices and application
@sthomastt
@sthomastt 9 ай бұрын
Excellent to the point(s) video. Is there a code repo with the examples, so I can save time remixing and experimenting?
@youneshenni5417
@youneshenni5417 9 ай бұрын
This is the future of Web Developement!!!!
@prateekbagrecha7012
@prateekbagrecha7012 8 ай бұрын
Could you please tell us the extensions that you are using to speed the development ?
@quickclean-ninja
@quickclean-ninja Жыл бұрын
Great thanks..finaly i got it
@Moh_ha
@Moh_ha Жыл бұрын
Amazing great work!
@codinginflow
@codinginflow 11 ай бұрын
Once the remaining router bugs are fixed, this will be amazing
@iwantfrens5804
@iwantfrens5804 5 ай бұрын
Leerob is fcking amazing!!! I love these videos!!!
@wfl-junior
@wfl-junior Жыл бұрын
I can't wait to use the app directory stable
@PyrexCelso
@PyrexCelso Жыл бұрын
This is awesome. If my main data source is prisma, is there a way to leverage this caching mechanism, without losing the type safety provided by it?
@allyk904
@allyk904 Жыл бұрын
İt s been incredible helpfull. Thanks
@oiojin831
@oiojin831 7 ай бұрын
clear explanation
@GuillaumeDuhan1
@GuillaumeDuhan1 Жыл бұрын
Thanks for this amazing video
@harshilpatel3389
@harshilpatel3389 9 ай бұрын
Finally i get the solution of routing. Huh. Please mention this specifically clear in the your website.
@maheshpratap5054
@maheshpratap5054 7 ай бұрын
Pages are reloading while navigating between routes using the component in app router! Is there any fix for this?
@TheDoguBati
@TheDoguBati 8 ай бұрын
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
@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?
@user-qu8hg3wt3i
@user-qu8hg3wt3i 3 ай бұрын
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?
@FrontendMedia
@FrontendMedia Жыл бұрын
Hi, thanks for tutorial! What icon theme are you using here? :)
@brahimo4701
@brahimo4701 2 ай бұрын
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??
@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
@developerpaul46
@developerpaul46 Жыл бұрын
Thanks Lee
@hugocastillo7647
@hugocastillo7647 9 ай бұрын
Vercerl i love next.js 13, im just a beginner but there´s is something i don´t understand is there a way i can define a header in the RootLayout but idk that this header doesn´t affect my about or other page i dont want it to be there.
@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
@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 10 ай бұрын
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
@mathiasriissorensen6994
@mathiasriissorensen6994 10 ай бұрын
I love this but I really miss a way to update the data when the user has interacted with an element, like updating their profile using a button. When using useSWR you can execute mutate(), and then the data is updating. Do we have something similar?
@islamabdelhakiim7258
@islamabdelhakiim7258 9 ай бұрын
Thanks a lot
@kasvith
@kasvith Жыл бұрын
Whats the best way to handle Auth and Pass state from server to client
@sumitsaha6941
@sumitsaha6941 Ай бұрын
Keep going sir.
@010timeboy27
@010timeboy27 9 ай бұрын
Anyone know how to call an API from a server side component, get the required data from an API, and then pass that data to context API so that it may be used by client-side components
@TheAkshayvirle
@TheAkshayvirle 10 ай бұрын
Which extension is used to predict all the async await fetch code generation that we see in the video?
@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.
@user-ty3iu3zv3d
@user-ty3iu3zv3d 3 ай бұрын
@vercel. I want to use the caching system like pinia or redux. it there a tutorial that explained it that way. so when I fetch something from a child node I can get it from a parent node somewhere else.
@almeidaofthejoel
@almeidaofthejoel Жыл бұрын
Is there a way to support static generation for dynamic routes similar to exporting fallback from getStaticPaths before next 13?
@mahdimohammed5393
@mahdimohammed5393 Жыл бұрын
Great video When the app folder will be stable do you know the date ?
@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 11 ай бұрын
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 :)
@qwerty-or1yg
@qwerty-or1yg 3 ай бұрын
I'm using app router. What if I want to display a sidebar on all /blog/[id] pages and keep main layout for all other pages? I've tried creating a separate layout for /blog, but it seems to inherit root layout as well, so I'm not too sure what would best approach would be? Somehow conditionally render a layout depending on a route?
@AhmadMughal1
@AhmadMughal1 6 ай бұрын
I have but one question which i am currently having an issue with and that is if the data is being cached and then we go to dynamic route such as blog/1 we can access the id through params but is there some way to use the data that exists inside the cache already to also be sent to that so i can access that data inside my dynamic routes or do i have to refetch the data again inside that dynamic route?
@martinmatuszek1277
@martinmatuszek1277 Жыл бұрын
What caught my attention was proposing type properties in Repository type definition. How VS Code have done that?
@TomasJansson
@TomasJansson Жыл бұрын
When experimenting with dynamic routes and looking at the x-vercel-cache header I noticed I only got a HIT on static routes, as soon as I used a dynamic route, like the blog post in the video, it resulted in a MISS. Why can I get the same level of caching on dynamic routes? Caching should be more dependent on the data on the page than the actual url.
@VictorSilvaDev
@VictorSilvaDev Жыл бұрын
The cache control, only works using the native fetch api ? or can I have the same behavior using axios for example?
@alsherifkhalaf7385
@alsherifkhalaf7385 10 ай бұрын
how can I use revalidateTag when using for example firebase or prisma to fetch data ?
@0kJaymie
@0kJaymie 11 ай бұрын
Can you use anything other than [id] for your dynamic route folder? I tried using something else but it doesn't work. Maybe I'm doing it wrong but I'm not getting any errors
@killiankavanagh3854
@killiankavanagh3854 10 ай бұрын
very helpful
@nasso_
@nasso_ Жыл бұрын
but how do i change the title of my page based on dynamic, client-side state? say, a text input for example?
@saichandrajagu6141
@saichandrajagu6141 Ай бұрын
please answer how to get the pathname as "emplopyee/[id]/edit" like this, cause i wanna give the pathnames a unque name (Or) can you explain how can we keep the navbar fr some pages and exclude for some pages based on pathnames only in next js app router.
@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?
@raphaelaboohi2438
@raphaelaboohi2438 Жыл бұрын
Hey, is it possible to do full ssg like in next 12 like to take new data at build time? like getStaticProps? Thank you
@redhood7105
@redhood7105 Жыл бұрын
Video about auth with new Next would be nice. How to protect routes and such
@virendrapatel775
@virendrapatel775 Жыл бұрын
Is it good to fetch data in both functions Page and genratemetadata How to reuse the same data when i am using axios
@vinayak2450
@vinayak2450 Жыл бұрын
How would the app know how many ISR pages it has to store it statically first at build time?
@kimbapslayer1995
@kimbapslayer1995 Жыл бұрын
If i bootstrap a next project with the traditional src dir but use next 13 are these server components still available? Is this App dir only features?
@changecollar
@changecollar Жыл бұрын
THANK YOU
@codinginflow
@codinginflow 11 ай бұрын
Is there a difference between no-cache, no-store and next.revalidate: 0?
@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.
@hludhlddly
@hludhlddly 5 ай бұрын
Whats the extension that you use to auto complete code? thanksss
@9622AX
@9622AX 10 ай бұрын
While deploying on vercel fetch failed cannot use localhost:3000 as an address to fetch data in production mode works ok in local env. I am using file based routing to fetch posts locally. Any fix?
@svregt
@svregt 8 ай бұрын
what is his theme ? do someone know? i want it so bad, looks amazing
@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.
@ya4dang1
@ya4dang1 10 ай бұрын
How to fetch data with bearer token in server component, i.e. how do we retrieve the bearer token?
@bhahmady
@bhahmady 5 ай бұрын
Hi, what is the suggestion or snippet extension?
@herruberraumundzeit6229
@herruberraumundzeit6229 9 ай бұрын
What if i want to use no-cache or revalidate on a async function like googleapi's auth & getRange from googlesheets ( wich is not a fetch function )?
@thedigitalceo
@thedigitalceo Жыл бұрын
Do I see an API folder in the app directory! Would’ve love to hear about that.
Next.js App Router Caching: Explained!
25:22
Vercel
Рет қаралды 74 М.
10 common mistakes with the Next.js App Router
20:37
Vercel
Рет қаралды 166 М.
Маленькая и средняя фанта
00:56
Multi DO Smile Russian
Рет қаралды 2,4 МЛН
Balloon Pop Racing Is INTENSE!!!
01:00
A4
Рет қаралды 15 МЛН
I DONT USE NEXT JS
54:01
ThePrimeTime
Рет қаралды 306 М.
All 29 Next.js Mistakes Beginners Make
1:45:10
ByteGrad
Рет қаралды 31 М.
NEW GPT-4o: My Mind is Blown.
6:28
Joshua Chang
Рет қаралды 201 М.
Dockerize Next.js & Deploy to VPS (EASY!)
19:43
ByteGrad
Рет қаралды 36 М.
Next.js App Router Authentication (Sessions, Cookies, JWTs)
11:31
Lee Robinson
Рет қаралды 125 М.
You might not need useEffect() ...
21:45
Academind
Рет қаралды 133 М.
Incrementally adopt the Next.js App Router
16:21
Lee Robinson
Рет қаралды 40 М.
This is the Only Right Way to Write React clean-code - SOLID
18:23
What % of charge do you have on phone?🔋
0:11
Diana Belitskay
Рет қаралды 288 М.
How Neuralink Works 🧠
0:28
Zack D. Films
Рет қаралды 27 МЛН
Эффект Карбонаро и бумажный телефон
1:01
История одного вокалиста
Рет қаралды 705 М.
Any Sound & Call Recording Option Amazing Keypad Mobile 📱
0:48
Tech Official
Рет қаралды 326 М.