The New Way To Create Protected Routes With React Router V6

Поділитися
Вставка
  • Опубліковано 31 гру 2024

КОМЕНТАРІ • 222

  • @DennisIvy
    @DennisIvy  Рік тому +6

    New video implements this same strategy but with a full backend that handles Sign-in, Logout, and registration here: ua-cam.com/video/pGNxoIoLt_Y/v-deo.html

    • @joaoarthurbandeira
      @joaoarthurbandeira Рік тому +4

      Hey Dennis! First of all, thanks a lot for all the great stuff!
      Could u do an up-to-date video using React + DRF and how to implement the authentication/register/login with JWT? Maybe a project?
      Cheers, man!

  • @ambrosearuwa9458
    @ambrosearuwa9458 2 роки тому +24

    God bless you @Dennis Ivy
    I was following your JWT tutorial and got frustrated when you got to the private route part and I spent the entire day on stackoverflow browsing for solutions but found nothing🤣🤣🤣 until I came back to UA-cam and searched for "private route" and this video was one of the first that popped up. Thanks

    • @edwinowino4018
      @edwinowino4018 Рік тому +1

      This is a life saver, I was also following the JWT tutorial and I have been stuck on private routes the whole day until i found this.

  • @semico-l-on
    @semico-l-on 9 місяців тому +1

    Thankyou Dennis. I've been stuck for 3 days implementing protected routes. Watched many videos but it was all complicated. But yours got me through!

  • @efeamioku3220
    @efeamioku3220 2 роки тому +5

    Implemented this for login using Local Storage and it works like magic.
    Thanks so much, You are my React Protected Route Hero.

  • @learningnoobi2156
    @learningnoobi2156 2 роки тому +3

    This is really my favourite feature of the new version . I am using this everytime

  • @ivancastillo161
    @ivancastillo161 11 місяців тому

    Thank you so much! Videos with the old outdated router versions are a dime-a-dozen. Couldn't find many other videos that actually explain the new method ^_^

  • @anubhavgupta7155
    @anubhavgupta7155 2 роки тому +2

    Thank You!! I wasn't upgrading my React version because there was not yet a tutorial about React router v6 😂.
    Now I can happily work on projects with the new version

  • @swapnilcodes
    @swapnilcodes 2 роки тому +2

    One of the best videos on Protected Routes in React Ever ! Loved it !

  • @appuser
    @appuser 2 роки тому +4

    Thank you, this was doing my head in. If anyone working on the React Router project sees this, please provide a couple more examples in the docos (could even link to this video if still best practice). There's also scant examples of the redirect _function_ which you can return/throw from loaders, which I suspect replaces or compliments the workflow in this video.

  • @borgestheborg
    @borgestheborg 2 роки тому +2

    This video couldn't have come at a better time for me!

  • @mullaarbazzz
    @mullaarbazzz 10 місяців тому

    You are life saver man. so on to the point and short and simple video. hatsss off to you

  • @Septumsempra8818
    @Septumsempra8818 Рік тому

    You just saved me from hours of banging my head on the desk and questioning the futility of my dreams.

  • @jhonesjhonatas5524
    @jhonesjhonatas5524 Рік тому

    Very good! good teaching, and the fact that I had the github repository helped me a lot, in a few minutes I was able to implement it in my application! Thanks for the content.

  • @benjaminkhoury304
    @benjaminkhoury304 Рік тому

    Thanks a lot was looking around for a couple of hours on how to do this, solved the problem I had with this video and a bit of tinkering!

  • @PaulAilincai
    @PaulAilincai Рік тому

    This video helped me fix my UX and consequently improve security on my product

  • @sasidharn323
    @sasidharn323 Рік тому

    Very valuable information explained in a short video, thank you so much Dennis.

  • @toppmoviehighlights
    @toppmoviehighlights 2 роки тому +1

    Great, video. Direct , incisive and practical.

  • @GMCorner
    @GMCorner Рік тому

    I was looking for this for so long. Thank you for the video

  • @petarkolev6928
    @petarkolev6928 2 роки тому +1

    Thanks for the awesome video, Dennis! It was really a time saver

  • @bingewatcher144
    @bingewatcher144 Рік тому

    This is the only yt video in which the Outlet is perfectly explained❤❤

  • @akomaningemmanuelsunday8424
    @akomaningemmanuelsunday8424 2 роки тому

    Sir Dennis, all I can say is God richly bless you, sir Thank you

  • @shabalins
    @shabalins 2 роки тому +1

    Great video on this topic! Relevant, clear and helpful.
    Thanks a lot!

  • @ahsanahsan1087
    @ahsanahsan1087 Рік тому

    Thank you for taking up this we want more videos like this really good bro

  • @JamesPage-g5z
    @JamesPage-g5z Рік тому

    thanks for sharing. Just a couple suggestions, you may also want to include dynamic routes(such as id's), and GuestRoutes to redirect the user to home if they are already logged in. But good tutorial with outlet. We used it where I worked at to stack routes and it worked great :)

  • @haseebalam9174
    @haseebalam9174 10 місяців тому

    This video helped me a lot as I was building a MERN Stack application

  • @Crossalter
    @Crossalter 2 роки тому

    Finally a video make sense!
    Thanks man, its help me so much to continue lerning about this.

  • @harekrishna4584
    @harekrishna4584 7 місяців тому

    i dont why this channel is so underated omgggg!!! this guy is awesome

  • @farnazzinnah8541
    @farnazzinnah8541 Рік тому

    Thanks man!! Imma subscribe you. I have been trying to fix this issue for last 3 days and I finally did it with your help. Really appreciate it! Keep up the good work and keep on helping programmers out

  • @Ali-Iybar
    @Ali-Iybar 2 роки тому

    Thank you for this short and focused video.

  • @teksaiyanhere
    @teksaiyanhere Рік тому

    Thanks a lot man you made my day, i got stuck with this issue for a whole day and this video just fixed it, Thanks a lot mate :)

  • @Smarteez83
    @Smarteez83 2 роки тому

    So much time saved with this video ! Per-fect !

  • @unyuzimfuraishimwejoykevin4812
    @unyuzimfuraishimwejoykevin4812 2 роки тому +3

    Quick video, Self-Explanatory, Made me hit the Subscribe button 😁😁

  • @TheOnkard
    @TheOnkard 2 роки тому +1

    Loving React content from you sire 👑

  • @yannickdurden
    @yannickdurden Рік тому

    Straightforward, thanks for the video 👌

  • @ignaciofreitas8183
    @ignaciofreitas8183 Рік тому

    Bro you rock! Thank you so much for avoiding me some headaches :)

  • @harshasrisameera8164
    @harshasrisameera8164 Рік тому

    Life saver, It worked without a blink thank you so much

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

    So good for me. Thank you man! You are really hero :)

  • @sushantabhowmick1031
    @sushantabhowmick1031 Рік тому

    Love you man ,
    Osm explanation with your documentation

  • @fortniteplaystation9050
    @fortniteplaystation9050 Рік тому

    Really looking for a video like this , thanks a lot

  • @chiho8119
    @chiho8119 2 роки тому +1

    I was looking for a simple but reliable solution, but this is good to go. Maybe I want to use something like a map function which loops through the object of routes with the responding path names and so on. But need to figure out how, but this solution helps me a lot.

  • @sarfaraz6582
    @sarfaraz6582 Рік тому

    Woow this is good i was actually rendering every component based on user authentication which is pretty inconvenient way

  • @aruns6214
    @aruns6214 8 місяців тому

    Most underrated channel😢😢😢

  • @alex_law_codes
    @alex_law_codes 11 місяців тому

    Thanks this was a really clean video!

  • @jaguilar718
    @jaguilar718 Рік тому

    Very straightforward, thank you!!!

  • @mubashir2859
    @mubashir2859 2 роки тому +1

    Thanks for quick help

  • @muhammad_abir
    @muhammad_abir 2 роки тому

    thanks a lot dennis..... I was very confused until watch this video

  • @olalekanemmanuel6767
    @olalekanemmanuel6767 Рік тому

    This is a lifesaver, I can't wrap my head around the new version, too many changes. I'll just stick to this for now

  • @smarq86
    @smarq86 2 роки тому

    Thank you! Great explanation. Was helpful in my React app!

  • @ValeryTeramin
    @ValeryTeramin 10 місяців тому

    Thank you, it is exactly what I was looking for

  • @hilkiahlavinier
    @hilkiahlavinier Рік тому

    Thanks much!! Just what I was looking for

  • @rohit87k
    @rohit87k Рік тому +1

    Thank you so much - you saved mine lots of time ✅

  • @Harikrishna_gunnala
    @Harikrishna_gunnala Рік тому

    after making auth.token : true , if you change the routes manually to "/login" it is directing to login page , but it shouldn't be

  • @Lotpite
    @Lotpite 2 роки тому

    Really thank you for this information, really simple and useful explanataion!!!

  • @stinkyhusky
    @stinkyhusky Рік тому

    Thank you so much for explaining this, I was finally able to make it work!

  • @FGA-47
    @FGA-47 2 роки тому

    Thanks Dennis that was really helpful.

  • @tayyabhaseeb8866
    @tayyabhaseeb8866 Рік тому

    Amazing video invaluable and straightforward ❤

  • @fasalkp5430
    @fasalkp5430 Рік тому +1

    it works fine but we have a problem here after landing login page and we are trying to go back its not happening why beacause in our privateRoute we are NAVIGATING or pushing instead of redirecting or replacing so if user clicks on back button from login its still in login page please provide a solution for this

  • @HimanshuSharma-pz9gv
    @HimanshuSharma-pz9gv 2 роки тому

    hey dennis you just saved my big project , Kudos : )

  • @FilipeFernandes-ic3os
    @FilipeFernandes-ic3os Рік тому

    Perfect! Thanks a lot for the explanation!

  • @OmarJuma001
    @OmarJuma001 Рік тому

    exactly what I need ed mahn. Thanks a lot😀

  • @aleeizhere
    @aleeizhere Рік тому

    Great video.
    Btw if you're having You cannot render a inside another . You should never have more than one in your app. error. Just remove the around the and change it to .... This worked for me.

  • @malingasarmandocumbane2300
    @malingasarmandocumbane2300 Рік тому

    Perfect, this is amazing.

  • @hypermeero4782
    @hypermeero4782 2 роки тому +1

    man, you saved me. THANK YOU!

  • @entertechinc
    @entertechinc 2 роки тому

    Great video Dennis. Thank you

  • @natcoziay
    @natcoziay 2 роки тому

    Thank you SOOOOOOOOOO Much! This was a life saver! Wish I could give you a hundred more likes.

  • @TheJenasandeep
    @TheJenasandeep Рік тому

    Great Explanation!

  • @fellypsantos_
    @fellypsantos_ 2 роки тому

    Thanks friend! Helped a lot !! :D

  • @AbdulAziz-iu9jk
    @AbdulAziz-iu9jk 2 роки тому

    It worked. Lol, Beth Hart is a blues artist. 🤩

  • @KKYT-fc3bu
    @KKYT-fc3bu 10 місяців тому

    Thank you so much. without any doubt i fully understand it and it did really work.

  • @xtremewolve
    @xtremewolve Рік тому

    Wow, awesome explaination

  • @LAITO1222
    @LAITO1222 2 роки тому

    thank you! now i know how to create a private route.

  • @IzharJumadi
    @IzharJumadi Рік тому

    awesome video, thanks for sharing!

  • @bryang3044
    @bryang3044 2 роки тому

    Very, very, nice video. Thank you.

  • @salpygidis
    @salpygidis 2 роки тому

    Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you

  • @mathewsaraujo2293
    @mathewsaraujo2293 2 роки тому

    Thanks, this video helped me a lot!

  • @DCMPSaliva
    @DCMPSaliva 2 роки тому

    You change lives dude

  • @suzonahmmed5736
    @suzonahmmed5736 2 роки тому

    You are the Boss. Thanks a lot! 😘😘👍👍

  • @juanchoprogramacion
    @juanchoprogramacion Рік тому

    Thank you, great work!

  • @matheuscarvalho87
    @matheuscarvalho87 2 роки тому

    You saved my life!! Thanks a lot!!!

  • @ElrondMcBong86
    @ElrondMcBong86 2 роки тому

    Awesome! quick and clear! :-)

  • @ayushgogna9732
    @ayushgogna9732 2 роки тому

    thanks glad someone has a answer

  • @speedofbytes
    @speedofbytes 2 роки тому

    Very cool man, interesting, used this logic in a app of mine

  • @HarishGGU
    @HarishGGU Рік тому

    very helpful video. thanks so much.

  • @masudranahimu3783
    @masudranahimu3783 Рік тому

    really good and informative video

  • @martincho111986
    @martincho111986 2 роки тому

    thank you very much!! this was very useful, you explanation was very great and understandable!!, comparin with others videos, so thanks again

  • @erfanattarzadeh4357
    @erfanattarzadeh4357 2 роки тому

    You saved my life. Thanks

  • @nicksonpinto2074
    @nicksonpinto2074 Рік тому

    How would you do this for server sessions where we get session from backend like an API. Won't it render login then go to that home?(assuming auth API call is made inside useEffect)

  • @alexeyshaykov
    @alexeyshaykov Рік тому

    Thanks a lot. U save my day!

  • @EpistemicFomo
    @EpistemicFomo 8 місяців тому

    Thank you so much! Will you please make a video about website architecture/MVC?

  • @d0gl0gic80
    @d0gl0gic80 Рік тому

    This is fantastic thank you

  • @sirjschool7926
    @sirjschool7926 2 роки тому

    This helped me out a lot!!

  • @aripovjr
    @aripovjr Рік тому

    Thank you Dennis

  • @luar4165
    @luar4165 2 роки тому +1

    this works good when the value of the boolean is already there. But what if is set as a result of an asynchronous operation? , like a user being set in an authContext, for example. Wouldn't this cause to be redirected right away, before the value gets updated?

    • @d33bo67
      @d33bo67 2 роки тому

      Just make sure, unlike he did in the vid, since it’s just an example, the login var is a state var and that the login page checks for it as well and redirects if true

  • @vikasni95
    @vikasni95 2 роки тому

    Wow great explanation tquu😊

  • @saulbenavides4037
    @saulbenavides4037 2 роки тому

    Thanks for sharing!

  • @mhslekbar
    @mhslekbar Рік тому +1

    Thank you soo much

  • @_MoshikoAz_
    @_MoshikoAz_ Рік тому

    thank you for the video,
    i have a question tho,
    how would you recommend to store the token, to maximize the security in the app ?
    assuming i already have a backend to handle the token for me

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

    Thanks, it's very helpful

  • @dr.slasher5346
    @dr.slasher5346 Рік тому

    great one keep it up!

  • @truecallerbackup8392
    @truecallerbackup8392 2 роки тому

    Thanks for informative video I'm understood everything is about auth thanks