Тёмный

Learn Next.js Parallel Routes In 16 Minutes 

Web Dev Simplified
Подписаться 1,6 млн
Просмотров 108 тыс.
50% 1

Next.js + React Course: reactsimplified.com/?...
The app directory massively overhauled and improved routing in Next.js by adding tons of new advanced features. One of those features is parallel routes which make working with complex UIs that contain many unique elements much easier. In this video I will break down everything you need to know about this concept and also talk about what this concept can do for you.
📚 Materials/References:
Next.js + React Course: reactsimplified.com/?...
🌎 Find Me Here:
My Blog: blog.webdevsimplified.com
My Courses: courses.webdevsimplified.com
Patreon: / webdevsimplified
Twitter: / devsimplified
Discord: / discord
GitHub: github.com/WebDevSimplified
CodePen: codepen.io/WebDevSimplified
⏱️ Timestamps:
00:00 - Introduction
00:55 - Parallel Route Basics
05:18 - Conditional Route Rendering
07:42 - Advanced Routing
#Nextjs #WDS #ParallelRoutes

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

 

22 май 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 194   
@dawidwraga
@dawidwraga 4 месяца назад
Vercel needs to watch this video and improve the DX here for sure
@tiktalk4573
@tiktalk4573 21 день назад
seems very DX friendly to me!
@skapator
@skapator 4 месяца назад
Is this the birth of the term folder/file hell ?
@theisoj
@theisoj 4 месяца назад
Great video! Thanks Kyle as always! 👍
@adammilner4512
@adammilner4512 4 месяца назад
this looks horrifying, so much overhead even in this super simple example
@untalentedwebdev
@untalentedwebdev 4 месяца назад
exactly my thots
@tiktalk4573
@tiktalk4573 21 день назад
I don't agree
@mohammadahmermalick7869
@mohammadahmermalick7869 4 месяца назад
Thanks you bro! I love your channel ❤️ You are doing a great job 👍
@BugsNRoses_
@BugsNRoses_ 4 месяца назад
happy new year kyle❤
@wchorski
@wchorski 4 месяца назад
would love a talk on how to create a template app that is shared between multiple clients. With tips on how to handle 1. unique assets 2. customer side configuration 3. adding and pushing updates across all instances of this app
@sujjee
@sujjee 4 месяца назад
Thank you for explaining parallel routes in such a simple and easily understandable way. By the way, could you also explain Drizzle the way you explained Prisma in one hour?
@marcialabrahantes3369
@marcialabrahantes3369 2 месяца назад
drizzle is most like SQL. you can learn SQL and it'll transfer over pretty seamlessly
@code_react
@code_react 4 месяца назад
WOW. this is amazing to learn.
@FerroMeow
@FerroMeow 4 месяца назад
Such a cool feature, I love this!
@adammilner4512
@adammilner4512 4 месяца назад
useless feature lol
@berniko4954
@berniko4954 3 месяца назад
@@adammilner4512 ikr lol
@nkululekomthimkulu1248
@nkululekomthimkulu1248 4 месяца назад
Looks cool. I'll try it out.
@theavazov
@theavazov 4 месяца назад
Great video Kyle, can you make a video about i18 in app routes?
@planesrift
@planesrift 4 месяца назад
Top notch developer experience.
@tom.watkins
@tom.watkins 3 месяца назад
The main benefit of this is being able to use the loading and error pages within each parallel route i am guessing. For most cases its fine to just import the server components, you hust have to remember to put your own suspense/error boundaries around them
@chrtravels
@chrtravels 2 месяца назад
I was wondering why this would be necessary when you could just import server components. This makes sense though. I could see the benefit of having the separate loading and error pages. I am not very familiar with using suspense/error boundaries, so that is something I need to delve into.
@tom.watkins
@tom.watkins 2 месяца назад
@@chrtravels loading and error pages are just a nice abstraction over having to put in your own suspense and error boundaries so it's a nice DX improvement for people less comfortable using them. That being said, it's worth knowing how to use them yourself as Suspense in particular is usefulfor other things in react, things like lazy imports and the new 'use' hook with promises as props both work very nicely with Suspense
@bayuputraefendi4717
@bayuputraefendi4717 4 месяца назад
Thanks, now i can improve my code
@anhvuuc8693
@anhvuuc8693 4 месяца назад
This still easy, Intercepting Routes is an headache :D Hope you can have a video for it
@nguyenchin7798
@nguyenchin7798 Месяц назад
thank you !!!
@VinayTandale
@VinayTandale 4 месяца назад
Its being complicated day by day easier the simpler the better
@otn987
@otn987 4 месяца назад
The conditional rendering works the same way using parallel routes or not with slightly different syntax. if(!isLoggedIn) return Vs. if(!isLoggedIn) return login. Am I missing something?
@ddrweb_
@ddrweb_ 4 месяца назад
Hi, thanks for the video. I have a question tho, If I create a route with parallel routes, why do I need to declare/create the parallel routes for my nested pages, maybe I want them just for the main parent , feels a bit weird :|
@whoman7930
@whoman7930 4 месяца назад
Yeah, that's really odd. I always have to add a default page that returns null to counter that. 🥲
@nemeziz_prime
@nemeziz_prime 4 месяца назад
Can you also do a simple video on subdomain routing in React/Next.js?
@kellingtoncrivelaro3929
@kellingtoncrivelaro3929 4 месяца назад
Would love It too
@milan5131
@milan5131 4 месяца назад
3:37 react has type for ts that makes it simpler to define types where u want to use children so you don't need to define type for children: PropsWithChildren
@firewatermoonsun
@firewatermoonsun 3 месяца назад
What if I don't want User Settings and Article Settings but just want /dashboard/settings with Settings folder?
@chrtravels
@chrtravels 2 месяца назад
The docs aren't clear but it sounds like the parallel route has to be a server component. I have a PostList server component, that I could turn into a parallel route, however I have a PostCard, which is imported into the PostList. The PostCart is a client component. So I would not be able to use the Parallel routing on the cards themselves? It's the cards that I would want to have the loading state on.
@WolfySpeaks
@WolfySpeaks 4 месяца назад
Bro, can you teach how to setup folder, to use StyleXjs with nodejs.
@havokgames8297
@havokgames8297 Месяц назад
This video did a good job of _how_ these works. But I really can't tell the _why_, because the examples are so generic. Is this useful for a multi-panel layout where you navigate within the panels separately? Maybe something like a playlist + music player?
@ahmadmuqadas78
@ahmadmuqadas78 3 месяца назад
i love your hiar bro
@user-ej8zb7id8v
@user-ej8zb7id8v 21 день назад
Anyone know if it's possible to have a wrapper layout or page to pass in props to the slots? The use case if there was interactivity outside of the parallel routes that can show/hide a particular slot from a button click.
@RadianRasyid
@RadianRasyid 3 месяца назад
i dont't know im not able to use parallel route just like how you do it. it worked for the root layout, but not for the nested route. i'm using nextjs version 14.1. maybe a little help?
@johnsimms9875
@johnsimms9875 4 месяца назад
What are the benefits of doing it this way? Is it faster/more performant?
@Slaat1
@Slaat1 3 месяца назад
10:40 thank you for touching on this! It's a shame this is so buggy in dev
@alirezak5870
@alirezak5870 Месяц назад
even if you use middle wares and auth packages on this feature you get in trouble more because slots children or any props you are passing in your layout don't work as you expected. and your route system completely make parallel bugs.
@lasindunuwanga5292
@lasindunuwanga5292 4 месяца назад
It is today I got it. Your channel name is real. It is not just a fancy name. You really make stuff simplified.
@user-ur9wf9tg5p
@user-ur9wf9tg5p 4 месяца назад
Thank you for the explanation on parallel routes. However, I was wondering if you could possibly show me what the code in the 'wait' function, which is located in the 'lib' folder, looks like? I would appreciate your help.
@BradenKelley
@BradenKelley 4 месяца назад
probably just something like `const wait = (ms: number) => new Promise(resolve => setTimeout(resolve, ms))`
@user-ur9wf9tg5p
@user-ur9wf9tg5p 4 месяца назад
@@BradenKelley Your answer helped me understand it better. I appreciate your assistance.
@a_m___s_y
@a_m___s_y 4 месяца назад
Parallel routing is powerful, but it's absolutely annoying when use it in development mode. Go through the document many times and finally find out the issue only exist in development mode from your video... thanks for your video
@aravind.a
@aravind.a 4 месяца назад
what is the advantage of this? We can also use swr to load each content on page.
@donaldpetervicente8351
@donaldpetervicente8351 4 месяца назад
Hi Kyle how do you do the shortcut to instantly imported the red tagging(error)(wait) that is not manually imported? what is the shortcut key? Thanks in advance.
@debopamgupta9505
@debopamgupta9505 4 месяца назад
Ctrl + . Will bring up the code actions in vscode which has many options, here you have the option to auto import the function
@donaldpetervicente8351
@donaldpetervicente8351 4 месяца назад
@@debopamgupta9505 Many thanks bro!😁
@movoyemickele
@movoyemickele 4 месяца назад
Hey Kyle, I'm curious if there's a method to eliminate the loading time experienced when navigating between pages in NextJS. I'm aiming to develop a Progressive Web App, but I've noticed that NextJS fetches each page from the server based on the URL, leading to some delay. This contrasts with React Router, where page transitions are nearly instantaneous since it doesn't require fetching the new page for every navigation. Is there a workaround or solution for this in NextJS? I almost think NextJS sucks for PWA.
@vivekkaushik9508
@vivekkaushik9508 4 месяца назад
PWA and SSR doesn't make sense. In order for an app to be PWA you've to make the app CSR so that client can download the entire app and run it offline
@movoyemickele
@movoyemickele 4 месяца назад
@@vivekkaushik9508 Do you have any insights on implementing this in NextJS? Simply specifying 'use client' doesn't work, as the app's router is designed to deliver individual pages for each specified URL. I'm looking to enable the user to download the entire app, similar to the experience with plain React where the user downloads the entire app. Any suggestions?
@twothreeoneoneseventwoonefour5
@twothreeoneoneseventwoonefour5 4 месяца назад
@@movoyemickele why are you even using nextjs then. That's like buying a car to go to a store 100m from your home. Use Vite instead for your purposes.
@jaspreetmaan121
@jaspreetmaan121 4 месяца назад
​@@movoyemickele if you don't use ssr, don't use next js
@acousticmunda6400
@acousticmunda6400 4 месяца назад
@@movoyemickele just use "use client" in the parent layout file
@Daddyjs
@Daddyjs 3 месяца назад
You are a Next js GOD
@KnaveKaiser
@KnaveKaiser 4 месяца назад
thank you for the great video. can you make a video demystifying internationalization in the next js 13 using app router? I'm having a hard time setting it up in a way where the default locale does not pollute the url. thanks again.
@carlosbotero1947
@carlosbotero1947 4 месяца назад
There is a really cool library called "next-roots" that have a great i18n solution .
@ismaeltinta6118
@ismaeltinta6118 4 месяца назад
+1
@RealRhythmandPoetry
@RealRhythmandPoetry 4 месяца назад
Can't remember how but I got it working with i18next and some youtube guides a while ago :)
@boglegogle
@boglegogle 4 месяца назад
Using i18Next, super easy to set up and works great. The default locale doesn't show up in the route and next handles all routing for you so if you never have to specify locale routes, it just does it
@ikbo
@ikbo 4 месяца назад
Why does the course say "next.js coming soon"? Has it not been released yet?
@griffadev
@griffadev 4 месяца назад
Tried using this feature and had to back it out because its so unstable (for the more advanced uses ) the fact it's so buggy in the tutorial only proves this
@thomasmiller1406
@thomasmiller1406 4 месяца назад
Cool, would be nice if there was away to define common children compents like loading and error. Personally i prefer this over being verbose but not going to lie running in dev mode looked absolutely horrendous!
@abubakarkhawaja6082
@abubakarkhawaja6082 Месяц назад
sounds like a video for "why you shouldn't use Parallel routes in Next.js"
@raphaelpicard8981
@raphaelpicard8981 4 месяца назад
Hello, I wanted to know if with your videos there is the possibility to put subtitles in French?
@Henrique01010
@Henrique01010 4 месяца назад
You did an amazing job explaining this. It looks like a clever way to place multiple server components in a single page, until it doesnt. It gets annoying really fast with the nested files and development mode gets super buggy. I cant believe Next is releasing this, the framework was once an example of great DX...
@jessyndaya9487
@jessyndaya9487 4 месяца назад
It's too much for nothing my friend 😅
@shawnxiong2011
@shawnxiong2011 2 месяца назад
This nextjs dark magic is overcooked
@dextrox2698
@dextrox2698 2 месяца назад
This feature may seems useless to some ppl but along the line it comes to tackle some problems i.e intercepting routine
@kenshinhimura3140
@kenshinhimura3140 4 месяца назад
I mean that the component folder in react is dead because now every pages have his folder component.
@DannyBLV
@DannyBLV 4 месяца назад
all these issues in dev mode doesn't worry anyone here ?
@TeaBroski
@TeaBroski 4 месяца назад
Like this if you appreciate Kyle's content but need to 1.5x to not follow asleep
@N8X4TE
@N8X4TE 4 месяца назад
What is a good use case for this?
@DavidSmith-ef4eh
@DavidSmith-ef4eh 4 месяца назад
Making developers switch to vue or svelte, I guess...
@N8X4TE
@N8X4TE 4 месяца назад
@@DavidSmith-ef4eh fr
@berniko4954
@berniko4954 3 месяца назад
@@DavidSmith-ef4eh lol thats why I switched to sveltekit, but then switched back after a month because uk,I do not want to be a broke
@unajujupiter6725
@unajujupiter6725 Месяц назад
unable apply conditional routes to home page, i guess the layout for home page is RootLayout which is a little bit different, anyone have done it before? just wondering.
@MrAlao675
@MrAlao675 4 месяца назад
One of the turn offs here is restarting dev server. Well I don't have a use for the complicated parallel routing for now😊
@naufalnasrullah6965
@naufalnasrullah6965 4 месяца назад
7:29 insert a login page inside of dashboard isn't good idea, it should have its route alone
@user-sc2dc4ud7b
@user-sc2dc4ud7b 4 месяца назад
You can name pages components with different names other than just "Page"?!
@jacobphillips9235
@jacobphillips9235 4 месяца назад
Thanks!
@WebDevSimplified
@WebDevSimplified 3 месяца назад
You're welcome! I am glad you enjoyed the video.
@saudalghamdi5608
@saudalghamdi5608 4 месяца назад
Hi Kyle, when are you going to launch the Next.js course? I'm thinking about learning Next.js and there is no better teacher in the JavaScript world than you!
@TabuHana
@TabuHana 4 месяца назад
Its in the description
@WebDevSimplified
@WebDevSimplified 4 месяца назад
It will most likely be this month
@user-ye2fw4do4d
@user-ye2fw4do4d 4 месяца назад
Can you make a video on how to create 2 diferent set of pages with same names but for mobile and for desktop so we don't need to have code mixed can have 2 diferent routing and as a plus if theres a way to make url only show main donain feven being in pages like maindomain/blog but i just see maindomain I was trying to do sometihng likes this App [...mobile] to catch all mobile (mobile) to group all mobile and create an invisible /mobile page.tsx store page.tsx page.tsx layout.tsx inside layout my idea was create an const isMobile = window.innerWidth
@rodrigocremella
@rodrigocremella 4 месяца назад
Great video. But I decided to skip Next JS only because the server error on each render/code change 🤧
@bpaintx2
@bpaintx2 4 месяца назад
Sounds like a code problem, not a Next JS problem ;)
@boglegogle
@boglegogle 4 месяца назад
That means you have an error... Next js hot loading works just fine
@mahadevovnl
@mahadevovnl 4 месяца назад
You can change the indentation of your file tree on the left in VSCode, could you please do that? The default 2px indentation is horrible and makes it hard to see what folder is inside what folder.
@Niksorus
@Niksorus 4 месяца назад
Hot damn, yet another way to do the exact same thing 🤣
@yashyadav5116
@yashyadav5116 4 месяца назад
learn by doing
@yashyadav5116
@yashyadav5116 4 месяца назад
parallel routing
@hanesmitter1469
@hanesmitter1469 4 дня назад
Though NextJS makes me give weird names to my files...I like weird names better within JS code in strings
@justafreak15able
@justafreak15able 4 месяца назад
Bro just rediscovered Components 😂
@ionutsandu5913
@ionutsandu5913 4 месяца назад
How is this a benefit over just creating components and conditionally render them?
@Rkdo_Dev
@Rkdo_Dev 3 месяца назад
in this point of time, nothing.
@Dylan_thebrand_slayer_Mulveiny
@Dylan_thebrand_slayer_Mulveiny 4 месяца назад
2:00 why would they inject HTML into the suspense component as a property. Shouldn't that be a slot instead? That seems incredibly bad to me. I can't possibly think of a legitimate reason to do it that way.
@okopyl
@okopyl 3 месяца назад
I did not understand a thing. Isn't it true that a route sits on a separate url? 1. Why do you render everything on one page? 2, How is it possible to have a parallel routes if a route is always loaded one at a time. If you have 2 route on the same route, ut's just a plain component, not?
@user-ud4bj9vc7l
@user-ud4bj9vc7l 3 месяца назад
NEED MORE FILES
@hellokevin_133
@hellokevin_133 4 месяца назад
I respect you and appreciate the work you put into your courses, but given the quality of the recent React & Next docs, I think it'd be silly to take a course or look elsewhere for learning these technologies.
@ts3798
@ts3798 4 месяца назад
No offense, but this is a stupid comment. A lot of people prefer to learn by watching videos.
@GermansEagle
@GermansEagle 4 месяца назад
I disagree. The documentation says how things are. The course is using it in a professional manner. There was docs on react hooks, but his course changed how to actually use them.
@Slaat1
@Slaat1 3 месяца назад
6:41 I know you wanted to give a good example but this isn't one, authentication should be handled in the middleware. you could have checked for user role and displayed different components
@DespicariPirates
@DespicariPirates 4 месяца назад
@lcarv20
@lcarv20 4 месяца назад
The dx looks awful. Having to restart the dev server frequently is annoying, not to mention the dev glitches that I have already spent hours trying to fix thinking it was a problem with my code.
@faizsyed658
@faizsyed658 4 месяца назад
True. Classic front end bloat
@DavidSmith-ef4eh
@DavidSmith-ef4eh 4 месяца назад
Great. I always wanted to restart my env after a change. Nextjs is really pushing things further...
@elephant_888
@elephant_888 4 месяца назад
Way too many abstractions. This makes me so happy I’m learning HTMX!! We’ve really gone crazy with the frontend frameworks. 😅
@DavidSmith-ef4eh
@DavidSmith-ef4eh 4 месяца назад
Crazy. I wanted to switch my teams project to the new app dir structure, but I guess we'll just stay with pages forever.
@DaviAreias
@DaviAreias 4 месяца назад
I started using nextjs on my journey but then changed to rust+ vite on the frontend and reduce ram usage from 100~120 MB to less than 10MB, that was before the newer nextjs versions btw
@DavidSmith-ef4eh
@DavidSmith-ef4eh 4 месяца назад
@@DaviAreias learning rust as well, but doubt i will push it in my company. It just makes no sense for them, since the bottleneck are the connection speeds and our database. but I will certainly use it for my own project. Don't know about vue though, react has a great ecosystem.
@rishiraj2548
@rishiraj2548 4 месяца назад
🙏👍
@0xAndy
@0xAndy 4 месяца назад
Thoughts on Parallel Routing in Next 👎 too much boilerplate 👎too buggy in dev (barely usable at times) 👎not ready for prod. Next should improve the DX immediately before pushing this further
@DavidSmith-ef4eh
@DavidSmith-ef4eh 4 месяца назад
Just look how many files he had to create. And we all know that creating files is the slowest part of developing :D
@kerovinvillegas6402
@kerovinvillegas6402 4 месяца назад
Im not really fan of this feature. Just dont overthink things. You can create this "parallel" with simple container component with less complicated pre-requirements.
@InsidiousGT
@InsidiousGT 3 месяца назад
This looked cool until the advanced routing section. DX took a nosedive at that point, should've left the feature off until the DX is baked
@ruanxun9454
@ruanxun9454 Месяц назад
Anyone having a real life use case using parallel routes?
@user-ei7dg6dw6i
@user-ei7dg6dw6i 18 дней назад
イケメン
@avijitchanda7944
@avijitchanda7944 4 месяца назад
I don't find anything good in this use case also don't know what next js trying to do 😅😅😅 I love pages even more
@josephmgift
@josephmgift 4 месяца назад
🎉
@rahilansari261
@rahilansari261 4 месяца назад
Why can't we just render components rather creating parallel route
@penyintastoxic
@penyintastoxic 4 месяца назад
I still dont understand how this feature will useful for my project
@DoItWithADance
@DoItWithADance 4 месяца назад
What a complete mess, I fail to see how this is simplifying my app code except bloating it. Perhaps it has uses in larger app code bases?
@valehisma
@valehisma 4 дня назад
thanks for the video. this feature doesn’t make any sense. why complicate it when you can just import components? Also, you can pass props easily if you have any
@Caldaron
@Caldaron 4 месяца назад
another "stable" feature of app router...
@amined801
@amined801 4 месяца назад
this is nice, but i think it's better to go with Laravel (Laravel ecosystem provide you everything you need depends on your project) instead of try to learn every next js new feature which maybe will change in future again haha
@bpaintx2
@bpaintx2 4 месяца назад
So Laravel never updates?
@amined801
@amined801 4 месяца назад
@@bpaintx2 they do but they don't change everything
@Goofy8907
@Goofy8907 25 дней назад
Is the purpose of this to increase app performance or just to improve the dev experience?
@jatul28
@jatul28 4 месяца назад
Why it's so much overly complex
@Marcosmapf
@Marcosmapf 4 месяца назад
So much complexity noise from the technology itself, looks so clunky to use
@maykon-oliveira
@maykon-oliveira 4 месяца назад
You speak so fast 🥲
@cqz89
@cqz89 21 день назад
App routers will add extra json at the end of your html, double page size, the response time is slower than page router.
@anthonyvolquez9514
@anthonyvolquez9514 4 месяца назад
first comment!
@vrushankgajula4584
@vrushankgajula4584 4 месяца назад
first reply
@bpaintx2
@bpaintx2 4 месяца назад
Boooooo
@Holykael1
@Holykael1 4 месяца назад
This feature is completely useless. Why create users and articles as "parallel routes" when you can just import the components into the dashboard and render them there
@macctosh
@macctosh 4 месяца назад
I have been asking myself this exact question.
@ShantanuAryan67
@ShantanuAryan67 4 месяца назад
probably useful with shallow routing. layout components wont remount, data wont be refetched
@neociber24
@neociber24 4 месяца назад
In NextJS app-dir each route can have it's own loading, error pages, this feature allow you to separate the logic. Also share the layouts.
@Holykael1
@Holykael1 4 месяца назад
@@neociber24 what's stopping you from defining those components in their own files and just importing. No need for any special feature
@k4f
@k4f 4 месяца назад
Agreed. This is some over engneered bs. And buggy as hell
@djangodeveloper07
@djangodeveloper07 4 месяца назад
now finally i can stop learning Next.js.
@DavidSmith-ef4eh
@DavidSmith-ef4eh 4 месяца назад
Next.js is getting out of hand. Formerly you could use code from your create-react-app SPA or client side rendered page, create a few files in the pages directory and call it a day. Now they want you to create millions of files, folders, subfolders. Never going to use app way. If they ditch pages, I'll replace the framework.
@Munja12
@Munja12 4 месяца назад
And not have SEO with SPA create-react-app.
Далее
Shadcn UI Crash Course #1 - Introduction & Setup
7:29
React Server Components Change Everything
15:48
Просмотров 185 тыс.
Чувака укусил зомби
00:13
Просмотров 69 тыс.
10 common mistakes with the Next.js App Router
20:37
Просмотров 170 тыс.
Why Signals Are Better Than React Hooks
16:30
Просмотров 446 тыс.
Parallel Routes in NextJs 14
21:27
Просмотров 17 тыс.
Learn TypeScript Generics In 13 Minutes
12:52
Просмотров 204 тыс.
NextJS Tutorial - All 12 Concepts You Need to Know
44:38
How This Test Saved Kent’s Site
7:04
Просмотров 62 тыс.