Next.js 14 Tutorial - 32 - Parallel Intercepting Routes

  Рет қаралды 46,664

Codevolution

Codevolution

Күн бұрын

Пікірлер: 89
@chinemelumchuba-nwene1503
@chinemelumchuba-nwene1503 6 ай бұрын
For anyone struggling to understand this particular video, I hope this my explanation clears it up a bit for you: The @modal parallel route is essential for enabling an overlay behavior when navigating within the photo-feed route. Here’s why it's needed and how it works: Overlay Functionality: Without the @modal parallel route, clicking on a photo in the /photo-feed route to navigate to /photo-feed/[id] would replace the entire page content. The @modal route allows the new content (the photo modal) to overlay the existing photo-feed page rather than replacing it. Simultaneous Rendering: Parallel routes like @modal and the main page (page.tsx of /photo-feed) are rendered simultaneously within the same layout (layout.tsx of /photo-feed). This simultaneous rendering enables both the main content and the modal to coexist on the screen. Default State: By default, the @modal route’s default.jsx file returns an empty component. Therefore, initially, you don’t see anything from the @modal route until it intercepts a specific route like /photo-feed/[id]. When this interception occurs, the modal content is displayed as an overlay. How it Works: Initial Load: When you first navigate to /photo-feed, Next.js renders both the @modal route (which is empty by default) and the main page content within the layout.tsx file of /photo-feed. Route Interception: When you click on a photo, navigating to /photo-feed/[id], the @modal route activates and displays the modal overlay without replacing the main photo-feed content. This approach ensures a seamless user experience where the photo modal overlays the existing content, maintaining the context of the photo-feed page.
@thefreemonk6938
@thefreemonk6938 6 ай бұрын
Thank you bro. I understood the video but still your comment will be really helpful to other people.
@paschalokafor9043
@paschalokafor9043 5 ай бұрын
Could he have used @modal/(.)[id]/page.tsx
@kumar7259-b4u
@kumar7259-b4u 5 ай бұрын
Thanks bro, it was struggling with it
@natcurti
@natcurti 5 ай бұрын
Amazing explanation, thank u so much
@AvikNayak_
@AvikNayak_ 5 ай бұрын
it's amazing how some people can explain with so much clarity.
@akindipejohn2595
@akindipejohn2595 Жыл бұрын
Thank you for your videos. Your explanations are intentionally simple, easy to understand and straight to the point. Hope to see more of these, especially on data fetching and backend in next js. Thank you.
@shiretsu
@shiretsu 5 ай бұрын
this is exactly why I like NextJS. In a previous project using a previous version, I manually created this functionality by manipulating the router behavior and URL. now it's built in!
@MSEIN2303
@MSEIN2303 10 ай бұрын
I think this video is complicated. I did not expect it😅😅
@zhiven7484
@zhiven7484 Жыл бұрын
Very nice video in these concepts! Can't wait to learn more from you.
@LeviAckerman-gy4rj
@LeviAckerman-gy4rj 2 ай бұрын
the modal component is insanely optimize nice job bro
@clashingtv2527
@clashingtv2527 2 ай бұрын
Basically the simplest explain of the video is - we intersept the parallel routing endpoint to show mini window and that intersepat so if you at constant stage it will show mini window until click on that segment or reload
@ainmosni4319
@ainmosni4319 7 ай бұрын
why people complain so much for someone who giving free good shit. If you guys follow along this series there is no way you don't understand this one. i have no complain with this vdo and love this.
@chrissmakoun
@chrissmakoun Жыл бұрын
It's a little bit complicated 😅 .I think we need a small project that contains all these patterns. Thank you.
@z.sayari
@z.sayari 2 ай бұрын
Thank u sir , simple explanation of this complex content . very useful
@leonzeng4139
@leonzeng4139 Жыл бұрын
where is the demo code in the github. I hope to have several branch for some video demo. I check your github ,it is 2 years ago.
@Tony-pq4ng
@Tony-pq4ng 6 ай бұрын
fyi, instead of using (..)photo-feed/[id], you can use (.)[id]
@dareal81
@dareal81 5 ай бұрын
This is exactly how I did it as well
@evenngmusic8868
@evenngmusic8868 Жыл бұрын
i wish i could watch all the videos asap
@SauravTiru
@SauravTiru 15 күн бұрын
So basically since the intercepted route is present inside the modal slot, and the modal is rendered in the layout.tsx, whenever next intercepts /photo-feed/id route, the model is rendered. Correct?
@SergioHernandez-lb1hs
@SergioHernandez-lb1hs 10 ай бұрын
I believe I missed something somewhere because I don't have the files shown here, the pictures, etc. Where can I find this information?
@gupta5882
@gupta5882 3 ай бұрын
For some reason I'm getting "Application error: a client-side exception has occurred (see the browser console for more information)." when I try intercepting routes for photo-feed! First I thought I messed up somewhere so I copied entire photo-feed folder and replaced with mine and still getting the same error! I'll appreciate any help that can resolve this, thanks
@Gabriel-kl6bt
@Gabriel-kl6bt 9 ай бұрын
It's not working for me this one. I receive some errors "Uncaught TypeError: initialTree is not iterable" and "The above error occurred in the component" when I click on an image.
@Emmanuel-pq5gs
@Emmanuel-pq5gs 9 ай бұрын
Heyy, we’re you able to fix the error ?? I’m currently facing the same error and been trying to fix it but to no avail
@zaim-wg9dq
@zaim-wg9dq 9 ай бұрын
Make sure you setup layout.tsx file in photo-feed directory
@jorgebello1298
@jorgebello1298 4 ай бұрын
I had the same problem.I fixed it adding error.tsx at the same level of layout.tsx and It works.
@thomasarpin9129
@thomasarpin9129 Жыл бұрын
Be careful with components in parallel routes. Prefetch default behavior in this example is a cost efficience killer 😂
@dhruvmehta2951
@dhruvmehta2951 2 ай бұрын
Application error: a client-side exception has occurred (see the browser console for more information). Can anyone help me with this error?
@castrox605
@castrox605 7 ай бұрын
I have problem when clicking the picture and it is not show the Modal as expected. Does anyone make it runnable?
@MisterDibitybopty
@MisterDibitybopty 6 ай бұрын
Make sure you have the layout file in photo-feed
@arhanus7963
@arhanus7963 Жыл бұрын
thanks for the informative videos it's really helpful.
@muratasarslan2359
@muratasarslan2359 Ай бұрын
Wonderful 🙏
@zulqadarabbas7567
@zulqadarabbas7567 7 ай бұрын
when I create (..)photo-feed/[id]. It doesnt allow me to type /
@marcosaugustoschultzwutke6670
@marcosaugustoschultzwutke6670 6 ай бұрын
You need to create the [id] folder inside (..)photo-feed. The page.tsx file must be created inside the [id] folder.
@marcosaugustoschultzwutke6670
@marcosaugustoschultzwutke6670 6 ай бұрын
But I inform you that the code is incomplete and an error occurs when invoking {props.modal} on the layout.tsx page.
@adibirta
@adibirta 8 ай бұрын
In Tutorial 32, it appears that 'photo-feed' is not one level above the '@modal' slot, but rather two levels above. However, if the first level above were designated as the slot '@modal', would it then directly correspond to 'photo-feed' as the first level? BIG LIKE!!👍
@martinmiz
@martinmiz 8 ай бұрын
It is (..)photo-feed/[id] The [id] is another folder inside the (..)photo-feed. VS code just shows them on the same level if there's only one folder below, so you might think it's only one overall folder.
@tanaymainkar1650
@tanaymainkar1650 7 ай бұрын
Hi Vishwas , can you explain what was the need of @modal parallel route
@chinemelumchuba-nwene1503
@chinemelumchuba-nwene1503 6 ай бұрын
The @modal parallel route is essential for enabling an overlay behavior when navigating within the photo-feed route. Here’s why it's needed and how it works: Overlay Functionality: Without the @modal parallel route, clicking on a photo in the /photo-feed route to navigate to /photo-feed/[id] would replace the entire page content. The @modal route allows the new content (the photo modal) to overlay the existing photo-feed page rather than replacing it. Simultaneous Rendering: Parallel routes like @modal and the main page (page.tsx of /photo-feed) are rendered simultaneously within the same layout (layout.tsx of /photo-feed). This simultaneous rendering enables both the main content and the modal to coexist on the screen. Default State: By default, the @modal route’s default.jsx file returns an empty component. Therefore, initially, you don’t see anything from the @modal route until it intercepts a specific route like /photo-feed/[id]. When this interception occurs, the modal content is displayed as an overlay. How it Works: Initial Load: When you first navigate to /photo-feed, Next.js renders both the @modal route (which is empty by default) and the main page content within the layout.tsx file of /photo-feed. Route Interception: When you click on a photo, navigating to /photo-feed/[id], the @modal route activates and displays the modal overlay without replacing the main photo-feed content. This approach ensures a seamless user experience where the photo modal overlays the existing content, maintaining the context of the photo-feed page. I hope this clears this up for you
@venzkie89
@venzkie89 10 ай бұрын
Intercepting route is very useful especially in e-commerce website. However, I am still curious on how to override/disable intercepting route in some cases for example a separate link within the card that will fully display the default route.
@famildoor
@famildoor 5 ай бұрын
if we use back button of browser the intercepting route page won't render anymore ! why ? what's the solution ? ( eg : after going to photo-feed/4 press f5 and then back button of the browser , then the modal never works :) )
@KkrDs97
@KkrDs97 4 ай бұрын
use can use the router to handle the back like this const router = useRouter(); const handleOpenChange = () => { router.back(); }; and pass that to the modal for onopenChange
@AmanChauhan-s9t
@AmanChauhan-s9t 4 ай бұрын
if your intercepting route is not working properly, then please delete the .next folder and run server again.
@aliyevruslan936
@aliyevruslan936 7 ай бұрын
forces you to have width and height. How did you get away with not having width and height?
@AslanMammadov-w9o
@AslanMammadov-w9o 8 ай бұрын
I am a bit confused. My understanding is that when we navigate, we display the page with the specified [id] as a modal, but as a regular page after reloading. However, I'm puzzled because despite the route changing and not repeating the photo mapping, we're still able to see other cards. Should i just accept this and keep in mind or there is any logic explanation?
@SuyashRajput-ro2ki
@SuyashRajput-ro2ki 8 ай бұрын
We can see that the @modal is a parallel route which is used in the layout.jsx But it does not contain a page.jsx file. Thats why when you render the page with cards of all the images no parallel route code for the @modal is being used But when you navigate to the specific product details by clicking on any of them the intercepting route defined gets hit, the layout get provided with appropriate code defined inside the intercepting route which is basically the popup image.
@SuyashRajput-ro2ki
@SuyashRajput-ro2ki 8 ай бұрын
Now as you asked for the photo mapping You can see that the layout contains two components -> children - which is responsible for rendering the grid of photos And the other modals - which is responsible for the pop up image
@AslanMammadov-w9o
@AslanMammadov-w9o 8 ай бұрын
@@SuyashRajput-ro2ki Now i can say that i have a complete understanding of this pattern. Thank you !
@williamsgobi3184
@williamsgobi3184 5 ай бұрын
Thank you for this video, it was awesome! However, we are creating a website and trying to use parallel and intercept routes. On our home path ('/'), we have some @parallelRoutes paths. In this case, we can't use parallel intercept routes. Do you have a solution? The problem occurs when we create any routes with @parallelRoutes on the home path; if we remove all @parallelRoutes, the other routes work fine.
@anggaadypratama3711
@anggaadypratama3711 3 ай бұрын
the problem is i can't pass a props from main page so i need to recall data
@charlesalbert5834
@charlesalbert5834 6 ай бұрын
I don't know man, am I the only one getting an application error after clicking any of the images? The expected result would be the modal to be activated but it's causing an error. I am able to access the individual images through the image IDs from the browser though. If any one has faced this before what could be the issue, my assumption would be on the photo-feed intercepting route
@pura_kotte
@pura_kotte 6 ай бұрын
I faced the same error and fixed it by deleting the .next directory. This will be automatically regenerated on the next run
@jorgebello1298
@jorgebello1298 4 ай бұрын
I had the same problem.I fixed it adding error.tsx at the same level of layout.tsx and It works.
@SajalBiswas-v3g
@SajalBiswas-v3g 9 ай бұрын
Thank you so much🤗🤗
@kenirwin5538
@kenirwin5538 7 ай бұрын
What part of the code is supposed to pass props.modal to the layout? I know that prop.children is implicitly using the return value from photo-feed/page.tsx, but I don't know where props.modal is coming from, and apparently neither does my app: I keep getting a 404 error that comes from the layout.tsx file. If I take out the {props.modal} in line 11, the error goes away.
@chinemelumchuba-nwene1503
@chinemelumchuba-nwene1503 6 ай бұрын
Within the @modal directory, create a default.tsx file that returns an empty component. Something like this export default function Default() { return null; }
@juliovicenteperez7172
@juliovicenteperez7172 10 ай бұрын
Thank You very much! You are the best!
@oleksandrvoichyshyn7486
@oleksandrvoichyshyn7486 10 ай бұрын
Hi! Thank you for the video! Could you explain, why default.tsx exist in @modal folder?
@SuyashRajput-ro2ki
@SuyashRajput-ro2ki 8 ай бұрын
I think when you visit the product/[id] route by entering the url in the browser( or say you refresh the page )since the @model parallel route does not contain a route folder for the route [id] and ut is being used inside the layout folder it should be provided with a default.tsx I think the code inside the default.tsx will just be a empty component
@arrasyrizqitaher3895
@arrasyrizqitaher3895 9 ай бұрын
Thanks for the tutorials! As a new user I got to learn many about next.js. Anyway, can I get the source code from this one? I've tried it and its error. I think I've missed couple things
@martinmiz
@martinmiz 8 ай бұрын
Check the description of the video. But if you don't quite understand the tutorial, it's better you go back a few videos behind other than checking for answers in the GitHub repo. That will help you more.
@abdulwahabsiddiqui1003
@abdulwahabsiddiqui1003 Жыл бұрын
sir plz help me : plz could you tell how to link custom jquery files in next js 14 .i link my custom jquery files whcih is present in my publick folder and i link in layout,js but some time its link fine and some time i reload the page then its not link 🤕🤕
@isaacdruin
@isaacdruin Жыл бұрын
Hello, I am here to help. Stop using jquery.
@shineLouisShine
@shineLouisShine 11 ай бұрын
😊
@sebababi333
@sebababi333 9 ай бұрын
Hello Vishwas, you forgot to include the Photo-Feed in the Github repository
@kenirwin5538
@kenirwin5538 8 ай бұрын
All of the lessons up until this one have been pretty clear, but this one tried to do too much with too little explanation. It required so much supporting code that the only way to follow along was to copy and paste the code instead of learning to write the code. And then once I copied and pasted, I got a bunch of errors.
@erhancemkorkmaz9731
@erhancemkorkmaz9731 9 ай бұрын
i did not find to source code on githube, where can i find it ?
@cguser
@cguser 9 ай бұрын
same question, how do I find those source code for modal and photo feed
@lawsonmichael2595
@lawsonmichael2595 Жыл бұрын
Is there still more tutorials for this series?
@2u841r
@2u841r 4 ай бұрын
Thank you
@BruceWayne-kw6xm
@BruceWayne-kw6xm Жыл бұрын
why aren't you posting more videos?? is the series completed?
@amrithsudarshan2062
@amrithsudarshan2062 7 ай бұрын
This one is really confused. please share the github repo url ,its really hard to find that . anyway, thanks for your video
@miftahulhabib6810
@miftahulhabib6810 7 ай бұрын
it's on his github repo
@kikevanegazz325
@kikevanegazz325 8 ай бұрын
I don't understand the need for a parallel route here. I thought the intercepted route alone will do the trick.
@saisuryatejachavatapalli
@saisuryatejachavatapalli 11 ай бұрын
Please complete remaining videos for Next.js 14
@ねこ-p1b7o
@ねこ-p1b7o 8 ай бұрын
And we haven't even gotten to client side server side things yet...
@joantsyn7578
@joantsyn7578 7 ай бұрын
Sup👍er class!
@shinnthantminn9758
@shinnthantminn9758 11 ай бұрын
wait for more next14
@Dreamain1102
@Dreamain1102 Жыл бұрын
Is it final for next js ?
@prafulkatlana3439
@prafulkatlana3439 11 ай бұрын
@codeevolution
@shineLouisShine
@shineLouisShine 11 ай бұрын
Probably not. 1. There are more concepts to learn. 2. He usually wraps up his series with a wrapping up sentence.
@mmaikechi
@mmaikechi 10 ай бұрын
your tutorial is great til you started to skip to the ready made code to save time :(
@hosseinaflaki3342
@hosseinaflaki3342 10 ай бұрын
please send my the source code
@miftahulhabib6810
@miftahulhabib6810 7 ай бұрын
it's on his github repo
@PratikKumarVishwakarma-sb4ue
@PratikKumarVishwakarma-sb4ue 4 ай бұрын
hindi me bana deta bhai plz
@z-onealdo6131
@z-onealdo6131 11 ай бұрын
The most terrible explanation I have ever seen
@ejazalam6512
@ejazalam6512 11 ай бұрын
32 videos still routes
@ridhamsavaliya556
@ridhamsavaliya556 2 ай бұрын
i can do this in react very easily by making any modal dont need any of this complex shit
Next.js 14 Tutorial - 33 - Route Handlers
7:02
Codevolution
Рет қаралды 66 М.
Маусымашар-2023 / Гала-концерт / АТУ қоштасу
1:27:35
Jaidarman OFFICIAL / JCI
Рет қаралды 390 М.
I'VE MADE A CUTE FLYING LOLLIPOP FOR MY KID #SHORTS
0:48
A Plus School
Рет қаралды 20 МЛН
КОНЦЕРТЫ:  2 сезон | 1 выпуск | Камызяки
46:36
ТНТ Смотри еще!
Рет қаралды 3,7 МЛН
10 common mistakes with the Next.js App Router
20:37
Vercel
Рет қаралды 236 М.
Next.js 14 Tutorial - 31 - Intercepting Routes
10:28
Codevolution
Рет қаралды 56 М.
Learn Next.js Intercepting Routes In 11 Minutes
11:08
Web Dev Simplified
Рет қаралды 37 М.
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 869 М.
Next.js 15 Ruins Caching Even More
13:56
Web Dev Simplified
Рет қаралды 50 М.
Learn Next.js Parallel Routes In 16 Minutes
16:18
Web Dev Simplified
Рет қаралды 142 М.
Next.js 14 Tutorial - 29 - Unmatched Routes
9:07
Codevolution
Рет қаралды 52 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 942 М.
Next.js App Router: Routing, Data Fetching, Caching
14:32
Vercel
Рет қаралды 338 М.
Маусымашар-2023 / Гала-концерт / АТУ қоштасу
1:27:35
Jaidarman OFFICIAL / JCI
Рет қаралды 390 М.