React Router in Depth #3 - Router Provider, createBrowserRouter & Outlet

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ต.ค. 2024
  • In this React Router tutorial, you'll learn how to create a browser router th "new way", using the createBrowserRouter function. You'll also learn about the Router Provider & Outlet components.
    ⭐⭐ Watch the whole course now (without ads) on Net Ninja Pro:
    netninja.dev/p...
    🐱‍💻 Access the course files on GitHub:
    github.com/iam...
    🐱‍💻 React Tutorial:
    On Net Ninja Pro - netninja.dev/p...
    On TH-cam - • Full React Tutorial #1...
    🐱‍💻 React Router Docs - reactrouter.co...
    🐱‍💻 VS Code - code.visualstu...

ความคิดเห็น • 89

  • @yerneroneroipas8668
    @yerneroneroipas8668 7 หลายเดือนก่อน +14

    Just 6 minutes in and you helped me solve an issue chatgtp was walking in circles with. Thank you.

    • @NetNinja
      @NetNinja  7 หลายเดือนก่อน +1

      Awesome :)

  • @ifechukwu7379
    @ifechukwu7379 ปีที่แล้ว +4

    Your calm and cool voice is the key to your success. It is soothing to the mind while it allows the brain to understand something so cryptic as React js

  • @traezeeofor
    @traezeeofor ปีที่แล้ว +3

    Incidentally the 2 tutorials I first learned React Router are now outdated. This video did an excellent job of presenting version 6.4 to me. Thanks so much!

  • @yu_pal
    @yu_pal 9 หลายเดือนก่อน +1

    This is one of the best code exspliners video I.have seen in years. Thank you

  • @youcefmantas4944
    @youcefmantas4944 ปีที่แล้ว +3

    your a legend you better open a school called ninja way or something like this where u give all your lessons in a real compus cause man i live so far away but i would come to learn from the master of teaching !!

    • @NetNinja
      @NetNinja  ปีที่แล้ว +1

      Aha, thank you Youcef :) very kind!

  • @maskman4821
    @maskman4821 ปีที่แล้ว +7

    Thank you Shaun for introducing the new React Router, the new features such as layout is acting like Next, Nuxt, Sveltekit, I assume it is inspired by these advanced frameworks 😘

  • @Teddyrobinson
    @Teddyrobinson 7 หลายเดือนก่อน +2

    I was gonna ask why it became so complicated, but I see everyone else already commented that too

  • @musafirfisabillah6566
    @musafirfisabillah6566 ปีที่แล้ว +2

    I LOVING THIS COURSE SO FAR

    • @NetNinja
      @NetNinja  ปีที่แล้ว +1

      Awesome, thanks for watching Musafir!

  • @romimaximus
    @romimaximus ปีที่แล้ว +28

    Reallly !!! ... So we went from a nice react-router layout and ease to work with, ....to this very confusing and complicated react-router layout !!! and the question is WHY !!! they have to complicate things ?? 😂😂😂😂

    • @OnlyJavascript
      @OnlyJavascript ปีที่แล้ว +1

      they nicely packed and found a house-fly inside it. All they did was to take out the housefly without making too much damage to the package. They at least have to strip off some layers before reaching it and took out the housefly. Guess what, release date has come and they decided to do it without wrapping it back. hence concluded. 😂😂😂😂

    • @OnlyJavascript
      @OnlyJavascript ปีที่แล้ว +3

      whatever, we have god's hands like NetNinja who can deliver it so good.

    • @dariusz4434
      @dariusz4434 ปีที่แล้ว +8

      I totally agree. The normal BrowserRouter was so siple and made a lot of sense. But now this whole boilerplating is just makes no sense and complicate everything.

    • @code2287
      @code2287 ปีที่แล้ว +4

      I am not using the createbrowser router thing lol unless I have to ....the regular way still works fine but am down with outlet tho

    • @surajbera865
      @surajbera865 ปีที่แล้ว

      This router system is as complicated as that in angular...

  • @tsots2501
    @tsots2501 2 หลายเดือนก่อน +3

    this seems so much more complicated than the previous basic react router stuff for achieving the same effect. Could someone explain the benefit of this method over the previous lesson's?

    • @terezachudejova4189
      @terezachudejova4189 หลายเดือนก่อน +1

      I am wondering the same. I get the logic of the previous tutorial pretty fast. But this new version of concept seems too hard to grasp for me and I just did ctrl c, ctrl v without deeper understanding.

    • @vishal40007
      @vishal40007 24 วันที่ผ่านมา

      The documentation says "enables the v6.4 data APIs like loaders, actions, fetchers and more."

  • @DevDailyChallenge
    @DevDailyChallenge ปีที่แล้ว

    Thank you for introducing the new React Router

  • @wakeup_programmer
    @wakeup_programmer 5 หลายเดือนก่อน

    wow that was a fabulous explanation, thank you so much net ninja, it was helpful

    • @NetNinja
      @NetNinja  5 หลายเดือนก่อน

      Glad it was helpful! :) thanks for watching

  • @mikaelnilsson8041
    @mikaelnilsson8041 ปีที่แล้ว +1

    Great video, but why can't I access a particular page by entering the URL directly in the URL-field of the browser? E.g. /page1. I can only access /page1 if I use a link on the web page, otherwise I get a 404. This works great during development, but not when its built. I guess I need to create URL rewrite rules to get it to work?

  • @JJ-nm8sh
    @JJ-nm8sh ปีที่แล้ว +1

    Awesome vid. Very nicely explained about the element= on Route. 👍

    • @NetNinja
      @NetNinja  ปีที่แล้ว

      Thanks :) Glad you liked it!

  • @ahmeddotgg
    @ahmeddotgg ปีที่แล้ว +2

    Thank you very much Shaun, will you also cover the method they used in tutorial in react-router-dom documentation page ?
    and thanks in advance

  • @afewthoughts7755
    @afewthoughts7755 ปีที่แล้ว +1

    Any plans for new svelteKit course as the sveltekit 1.0 just released?

  • @Ayoubased
    @Ayoubased 7 หลายเดือนก่อน +2

    bro Im so confused with this outlet and why we use it, basically having Route path and createBrowserRouter with the path and element is enough to navigate, I have it in my code but dont understand it

  • @stefanmasic1287
    @stefanmasic1287 ปีที่แล้ว

    I'm amaized. So clear definitions. Perfect video.

  • @khalidsultani1896
    @khalidsultani1896 ปีที่แล้ว

    thanks for posting this awesome series .

    • @NetNinja
      @NetNinja  ปีที่แล้ว

      Glad you enjoy it!

  • @FrostDrive
    @FrostDrive ปีที่แล้ว +7

    holy crud they made the new way so much more complicated.

    • @user-xedwsg
      @user-xedwsg ปีที่แล้ว

      yup, no unceseary!

  • @levm_prog1461
    @levm_prog1461 ปีที่แล้ว

    Thanks for this video, you really helped me!

  • @Aditya-jo1of
    @Aditya-jo1of ปีที่แล้ว +1

    02:56 tree of routes🤣🤣 the way he spoke routes

  • @stephenagyei2740
    @stephenagyei2740 ปีที่แล้ว +1

    great video...what if you have and admin page with login and register pages...And you dont want to show the header and footer on those pages

    • @code2287
      @code2287 ปีที่แล้ว +1

      You can make it a route path on its own which won't be part of the parent layout

  • @scarredgaruga
    @scarredgaruga ปีที่แล้ว

    i have a question. If i have a sidebar for layout, should i placed in too? just like navbar?

    • @sejalsankhe3786
      @sejalsankhe3786 11 หลายเดือนก่อน

      yup according to me you will just need to custom css it and add flex-column

  • @AkashYadav-di6kd
    @AkashYadav-di6kd หลายเดือนก่อน

    Thank you very much, sir

    • @NetNinja
      @NetNinja  หลายเดือนก่อน

      You are most welcome! :)

  • @waltert9
    @waltert9 ปีที่แล้ว

    awesome stuff, really easy to understand now

    • @NetNinja
      @NetNinja  ปีที่แล้ว

      Good to hear that Walter :)

  • @BillaSaheb786
    @BillaSaheb786 ปีที่แล้ว +1

    Great Marvelous....Also put vue 3 and nuxt 3 project

  • @realgecko
    @realgecko ปีที่แล้ว

    Thank you very much!

  • @GethushanRavichandran
    @GethushanRavichandran ปีที่แล้ว +1

    Please create a Playlist about "Creating E-Commerce Website using Strapi , MongoDB, React , and Stripe"

    • @nickwoodward819
      @nickwoodward819 ปีที่แล้ว +1

      ...using only your left hand. thanks.

  • @catreunion
    @catreunion ปีที่แล้ว

    Thank you teacher 🙏🏻

    • @NetNinja
      @NetNinja  ปีที่แล้ว

      You are very welcome, thanks for your support Isaac!

  • @utkarshguruji8894
    @utkarshguruji8894 5 หลายเดือนก่อน

    In lecture 3rd , Navlink and links are working even without putting them in Homelayout as prop

  • @bakmyster
    @bakmyster ปีที่แล้ว

    Thanks for this!

    • @NetNinja
      @NetNinja  ปีที่แล้ว

      No problem, hope it helped :)

  • @martinmica4260
    @martinmica4260 11 หลายเดือนก่อน

    You're a legend.

  • @outletshelssy
    @outletshelssy ปีที่แล้ว

    Excelente Video

    • @NetNinja
      @NetNinja  ปีที่แล้ว

      Thanks! :)

  • @leooramone
    @leooramone ปีที่แล้ว

    very useful

  • @Zezinhodovasco
    @Zezinhodovasco ปีที่แล้ว

    why my main outlet component stay in the same place of my header? And not below it? I did the same thing as you

  • @vijaycheza
    @vijaycheza ปีที่แล้ว

    Awesome videos dude!

  • @bishwajeetpandey1570
    @bishwajeetpandey1570 ปีที่แล้ว

    You are the best❤

  • @thedipushut
    @thedipushut ปีที่แล้ว

    How can i use this concept with protected route??

  • @matinisnotdefined
    @matinisnotdefined ปีที่แล้ว

    Thanks a lot

  • @MostafaEl-Sayed-ld3he
    @MostafaEl-Sayed-ld3he ปีที่แล้ว +3

    am I the only one who see this version is so complicated?

    • @ibiyemisamuel6082
      @ibiyemisamuel6082 ปีที่แล้ว +1

      It's seems, but it's not. It actually provides more flexibility.

    • @Joshua.Developer
      @Joshua.Developer 26 วันที่ผ่านมา

      @@ibiyemisamuel6082 New devs don't know enough to make those calls this is a headache bro. This is the bad thing about React too much flexibly great if your experienced but if your trying to learn.... there are prob 9 different ways of doing this.

  • @fireace5920
    @fireace5920 ปีที่แล้ว

    anyone know how to add page transition animation with router provider and framer motion? I've try putting animatepresence around the router provider and it has not been working

  • @michalnowak2181
    @michalnowak2181 ปีที่แล้ว

    thx

  • @mohamedyoussef8835
    @mohamedyoussef8835 ปีที่แล้ว

    Awesome video +++++++++++ 😀

  • @olegwork3355
    @olegwork3355 ปีที่แล้ว +3

    very informative thanks, their docs is completley unreadable... !

    • @NetNinja
      @NetNinja  ปีที่แล้ว

      Glad you found it helpful Oleg!

  • @ONealOmbu
    @ONealOmbu ปีที่แล้ว

    I was hoping this vid would have something on HashRouter, Oh Well :(

  • @towatch
    @towatch ปีที่แล้ว

    ♥️♥️🔥

  • @exe.m1dn1ght
    @exe.m1dn1ght 8 หลายเดือนก่อน

    One question : Why ?

  • @MosesKuria-m8e
    @MosesKuria-m8e ปีที่แล้ว +2

    christ this was so confusing

  • @akrammekbal8936
    @akrammekbal8936 ปีที่แล้ว +2

    omg vujs is better

    • @mt.designers
      @mt.designers 10 หลายเดือนก่อน +1

      Totally agree. I'm also coming from Vue.js and in comparison, React is just ridiculously complicated. I mean they could have just created all of that and put it in one component just like Vue "RouterView" component.

  • @agoodmansaid
    @agoodmansaid 3 หลายเดือนก่อน

    Geez! what a way to OVER-COMPLICATE a straight forward concept. What ever happened to "if it ain't broke..."?

  • @mil0s251
    @mil0s251 ปีที่แล้ว

    browser router

  • @darelbvcr687
    @darelbvcr687 ปีที่แล้ว +1

    NextJs > React

  • @user-xedwsg
    @user-xedwsg ปีที่แล้ว

    This new way is TERRIBLE!

  • @bissogood
    @bissogood 3 หลายเดือนก่อน

    ok so what in the heck happen to just importing BrowserRouter as Router, Routes, Route...etc This is STUPID!

  • @gayspunchbop
    @gayspunchbop ปีที่แล้ว

    ahh this reminds me of nextjs