Next.js 14 Tutorial - 32 - Parallel Intercepting Routes

Поділитися
Вставка
  • Опубліковано 20 гру 2023
  • 📘 Frontend Interview Course - learn.codevolution.dev/
    💖 Support UPI - support.codevolution.dev/
    💖 Support Paypal - www.paypal.me/Codevolution
    💾 Github - github.com/gopinav
    📱 Follow Codevolution
    + Twitter - / codevolutionweb
    + Facebook - / codevolutionweb
    📫 Business - codevolution.business@gmail.com
    Next.js 14
    Next.js Tutorial
    Next.js 14 Tutorial
    Next.js Tutorial for Beginners
    Parallel Intercepting Routes
    Parallel Intercepting Routes in Next.js

КОМЕНТАРІ • 66

  • @chinemelumchuba-nwene1503
    @chinemelumchuba-nwene1503 15 днів тому +8

    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 9 днів тому +1

      Thank you bro. I understood the video but still your comment will be really helpful to other people.

    • @paschalokafor9043
      @paschalokafor9043 3 години тому

      Could he have used @modal/(.)[id]/page.tsx

  • @akindipejohn2595
    @akindipejohn2595 6 місяців тому +3

    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.

  • @zhiven7484
    @zhiven7484 6 місяців тому +4

    Very nice video in these concepts! Can't wait to learn more from you.

  • @arhanus7963
    @arhanus7963 6 місяців тому +1

    thanks for the informative videos it's really helpful.

  • @juliovicenteperez7172
    @juliovicenteperez7172 4 місяці тому

    Thank You very much! You are the best!

  • @evenngmusic8868
    @evenngmusic8868 6 місяців тому +6

    i wish i could watch all the videos asap

  • @user-ks5ch4ir4y
    @user-ks5ch4ir4y 3 місяці тому

    Thank you so much🤗🤗

  • @MSEIN2303
    @MSEIN2303 4 місяці тому +3

    I think this video is complicated. I did not expect it😅😅

  • @leonzeng4139
    @leonzeng4139 6 місяців тому +7

    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.

  • @venzkie89
    @venzkie89 4 місяці тому

    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.

  • @SergioHernandez-lb1hs
    @SergioHernandez-lb1hs 4 місяці тому +1

    I believe I missed something somewhere because I don't have the files shown here, the pictures, etc. Where can I find this information?

  • @chrissmakoun
    @chrissmakoun 6 місяців тому +17

    It's a little bit complicated 😅 .I think we need a small project that contains all these patterns. Thank you.

  • @lawsonmichael2595
    @lawsonmichael2595 6 місяців тому

    Is there still more tutorials for this series?

  • @ainmosni4319
    @ainmosni4319 Місяць тому

    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.

  • @thomasarpin9129
    @thomasarpin9129 6 місяців тому +2

    Be careful with components in parallel routes. Prefetch default behavior in this example is a cost efficience killer 😂

  • @joantsyn7578
    @joantsyn7578 Місяць тому

    Sup👍er class!

  • @aliyevruslan936
    @aliyevruslan936 Місяць тому

    forces you to have width and height. How did you get away with not having width and height?

  • @saisuryatejachavatapalli
    @saisuryatejachavatapalli 5 місяців тому

    Please complete remaining videos for Next.js 14

  • @oleksandrvoichyshyn7486
    @oleksandrvoichyshyn7486 4 місяці тому

    Hi! Thank you for the video!
    Could you explain, why default.tsx exist in @modal folder?

    • @SuyashRajput-ro2ki
      @SuyashRajput-ro2ki 2 місяці тому

      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

  • @tanaymainkar1650
    @tanaymainkar1650 Місяць тому +1

    Hi Vishwas , can you explain what was the need of @modal parallel route

    • @chinemelumchuba-nwene1503
      @chinemelumchuba-nwene1503 15 днів тому

      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

  • @kenirwin5538
    @kenirwin5538 2 місяці тому +1

    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.

  • @adibirta
    @adibirta 2 місяці тому +1

    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 2 місяці тому +1

      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.

  • @sebababi333
    @sebababi333 3 місяці тому

    Hello Vishwas, you forgot to include the Photo-Feed in the Github repository

  • @Tony-pq4ng
    @Tony-pq4ng 16 днів тому

    fyi, instead of using (..)photo-feed/[id], you can use (.)[id]

  • @shinnthantminn9758
    @shinnthantminn9758 5 місяців тому

    wait for more next14

  • @BruceWayne-kw6xm
    @BruceWayne-kw6xm 6 місяців тому

    why aren't you posting more videos?? is the series completed?

  • @Gabriel-kl6bt
    @Gabriel-kl6bt 3 місяці тому +1

    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 3 місяці тому

      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 3 місяці тому

      Make sure you setup layout.tsx file in photo-feed directory

  • @user-bp4qw7nm8v
    @user-bp4qw7nm8v 2 місяці тому

    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 2 місяці тому

      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 2 місяці тому

      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

    • @user-bp4qw7nm8v
      @user-bp4qw7nm8v 2 місяці тому +1

      @@SuyashRajput-ro2ki Now i can say that i have a complete understanding of this pattern. Thank you !

  • @arrasyrizqitaher3895
    @arrasyrizqitaher3895 3 місяці тому

    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 2 місяці тому

      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 6 місяців тому +1

    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
    🤕🤕

  • @charlesalbert5834
    @charlesalbert5834 13 днів тому +1

    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 5 днів тому +1

      I faced the same error and fixed it by deleting the .next directory. This will be automatically regenerated on the next run

  • @castrox605
    @castrox605 Місяць тому

    I have problem when clicking the picture and it is not show the Modal as expected. Does anyone make it runnable?

  • @zulqadarabbas7567
    @zulqadarabbas7567 Місяць тому +1

    when I create (..)photo-feed/[id]. It doesnt allow me to type /

    • @marcosaugustoschultzwutke6670
      @marcosaugustoschultzwutke6670 Місяць тому

      You need to create the [id] folder inside (..)photo-feed. The page.tsx file must be created inside the [id] folder.

    • @marcosaugustoschultzwutke6670
      @marcosaugustoschultzwutke6670 Місяць тому

      But I inform you that the code is incomplete and an error occurs when invoking {props.modal} on the layout.tsx page.

  • @erhancemkorkmaz9731
    @erhancemkorkmaz9731 3 місяці тому

    i did not find to source code on githube, where can i find it ?

    • @cguser
      @cguser 3 місяці тому

      same question, how do I find those source code for modal and photo feed

  • @amrithsudarshan2062
    @amrithsudarshan2062 Місяць тому

    This one is really confused. please share the github repo url ,its really hard to find that . anyway, thanks for your video

  • @Dreamain1102
    @Dreamain1102 6 місяців тому

    Is it final for next js ?

    • @prafulkatlana3439
      @prafulkatlana3439 6 місяців тому

      @codeevolution

    • @shineLouisShine
      @shineLouisShine 5 місяців тому +1

      Probably not.
      1. There are more concepts to learn.
      2. He usually wraps up his series with a wrapping up sentence.

  • @user-ww4gz7wx4t
    @user-ww4gz7wx4t 2 місяці тому

    And we haven't even gotten to client side server side things yet...

  • @ejazalam6512
    @ejazalam6512 5 місяців тому

    32 videos still routes

  • @maikechi1345
    @maikechi1345 4 місяці тому +1

    your tutorial is great til you started to skip to the ready made code to save time :(

  • @hosseinaflaki3342
    @hosseinaflaki3342 4 місяці тому +1

    please send my the source code

  • @z-onealdo6131
    @z-onealdo6131 5 місяців тому +3

    The most terrible explanation I have ever seen

  • @kenirwin5538
    @kenirwin5538 Місяць тому

    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 15 днів тому

      Within the @modal directory, create a default.tsx file that returns an empty component. Something like this
      export default function Default() {
      return null;
      }

  • @kikevanegazz325
    @kikevanegazz325 2 місяці тому

    I don't understand the need for a parallel route here. I thought the intercepted route alone will do the trick.