How To Redirect In React - React Router V5 Tutorial | Redirecting, useHistory...

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

КОМЕНТАРІ • 188

  • @PedroTechnologies
    @PedroTechnologies  2 роки тому +19

    Hey everyone! React router updated and now the useHistory hook doesn't exist anymore. I made a video going over the useNavigate hook which does the same thing: ua-cam.com/video/UjHT_NKR_gU/v-deo.html

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

      Correct 😉!

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

      Step 1- import {useNavigate} from 'react-router-dom';
      Step 2- let navigate = useNavigate();
      Step 3- navigate('/path');

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

      Suggestion, just edit the video and add a picture that contains this comment.

  • @mks33621996
    @mks33621996 3 роки тому +5

    Finally the right resource I was looking for with simple explanations and implementations. Thanks, PedroTech!

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

    This video was really helpful. I am a beginner and was very confused about this concept. Thank u

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

      Glad it was helpful!

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

      Me too man ,as a beginner I find this authenticated login part is tough

  • @justACasualProgrammer
    @justACasualProgrammer 3 роки тому

    I agree! the docs for the react-router-dom is very confusing for beginners, this video is the best way to explain the concept of redirect in the simplest way.

  • @aakash1103jha
    @aakash1103jha 3 роки тому +4

    This video was such a great help, and helped me to find, and understand, what I was doing wrong. Thanks a lot. Cheers man!

  • @eusouluao
    @eusouluao 3 роки тому +7

    Cara, vc fez o tutorial que eu tava precisando! Btw, meus projetos tô construindo seguindo o que aprendo aqui kkkk valeu demais!

  • @TheRailfanz
    @TheRailfanz 3 роки тому +5

    Perfect tutorial on perfect time for me! Thank you Pedro!

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

    It's amazing to me something as basic and central as linking to other pages loading data has so much inconsistency between the methods to achieve it and many don't work for some reason depending on how the data is structured and being fetched. The way you said you were surprised at how much of an issue this was for newcomers is very much expected to me, I'm new to React and the official docs don't go into it from what I see, while I try referencing material from the official site for React Router and it's been annoying to get working right now.

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

    This was how I thought things worked but I wasn't sure. Thanks for the clarification.

  • @hamzahahmad1670
    @hamzahahmad1670 3 роки тому +3

    Really enjoying the constant flow of quality tutorials. I'm hoping your channel blows up soon

  • @FarazGhani
    @FarazGhani 3 роки тому +1

    Other really confusion the code. you explain it very sweetly. my problem solve just in 5 mint.

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

    This short tutorial is so good

  • @prashinmore2251
    @prashinmore2251 3 роки тому +1

    You always have the perfect video for whatever I need. Thanks a lot

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

    Inglês brabo!! Ótimo video Pedrão!!!

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

    Thank you! Simple! useNavigate makes it even SIMPLIER!!!

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

    You are my second react teacher. Thank u so much

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

    You are the best teacher I have on youtube. Please I want you to do a video on how to add
    * thank you page to emailjs react code *.
    I have been battling with that for weeks

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

    Thanks for your vids Pedro ! You're explaining very well, you're the best !! 😁

  • @bluesteel1
    @bluesteel1 3 роки тому

    this is exactly what i was searching for

  • @angelrattaner4160
    @angelrattaner4160 3 роки тому +1

    i love you no bullshit exactly what i needed keep the good work man!!

    • @PedroTechnologies
      @PedroTechnologies  3 роки тому

      Hahaha I appreciate the support!

    • @everybodyneedsinspiration1757
      @everybodyneedsinspiration1757 3 роки тому

      @@PedroTechnologies man, how can I redirect to a URL only one per session? If they go back, will not be redirexted again

  • @jcavenue
    @jcavenue 3 роки тому

    I bet this is the best tutorial for redirect!

  • @INfoUpgraders
    @INfoUpgraders 3 роки тому +3

    Love the react tutorials 🙏

  • @nwobodogeorge5370
    @nwobodogeorge5370 3 роки тому +1

    Thank you. I love the way you simply things

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

    You are one of the best brothers...

  • @MrComicSG
    @MrComicSG 3 роки тому

    Thankyou so much for this simple tutorial. Short and well explained

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

    thanks you , i watched 2,3 videos and i wasnt getting it .... now i know what to do

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

    Thanks, PedroTech!

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

    Thank you very much Pedro!

  • @joelkratos2011
    @joelkratos2011 3 роки тому

    Duuuude you are amazing! Thank you so much for this tutorial

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

    one thing I learnt today is if your app didn't show other pages and you use in Route "component" you can use "element" hope it Works

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

    Dude, I would give you a kiss if I could, thank you so much!!!

  • @shanzanematnemat5842
    @shanzanematnemat5842 3 роки тому

    short and clear tutorial !

  • @dawoodshahzad9082
    @dawoodshahzad9082 3 роки тому +1

    very easy to understand. Thumbs up bro!

  • @olgalucia806
    @olgalucia806 3 роки тому

    Excelente video, Amazing video, Regards from Colombia

  • @WendyLiving
    @WendyLiving 3 роки тому

    Straight to the point 👌🏼

  • @corinadavid1813
    @corinadavid1813 3 роки тому +1

    Finally a good explanation

  • @jonathan_bestprime
    @jonathan_bestprime 3 роки тому +1

    Thank you very much from Colombia!

  • @piuskariuki5295
    @piuskariuki5295 3 роки тому +1

    Good stuff Pedro. Thank you.

  • @MyGURUPREET
    @MyGURUPREET 3 роки тому

    Thanks for this video,helped me in my work.

  • @varaprasad4163
    @varaprasad4163 3 роки тому +1

    Thanks, Brudda! such great content.

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

    Thank you so much! This was so helpful!

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

    Yes this video is very helpfull, but i had doubt bro. after filling the form can we redirect the profile page ??

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

    Thank you! so helpful!

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

    thank you so much. This really helped.

  • @rangabharath4253
    @rangabharath4253 3 роки тому +1

    Awesome as always 👍😀

  • @oomkaarkhamitkar5499
    @oomkaarkhamitkar5499 3 роки тому

    bro you save my life it work

  • @sarvarkhalimov111
    @sarvarkhalimov111 3 роки тому

    Thank you so much Pedro)

  • @hcam93
    @hcam93 3 роки тому +1

    Really helpful thank you

  • @abhaytiwari6411
    @abhaytiwari6411 3 роки тому

    I Appreciate your Hard Work.

  • @juliengeffriaud3249
    @juliengeffriaud3249 3 роки тому

    Thanks a lot, just what I needed :-)

  • @kabburebh
    @kabburebh 3 роки тому +1

    thanks pedro, this tutorial was really helpful. How do I set the prop to true or false in app.js

    • @PedroTechnologies
      @PedroTechnologies  3 роки тому

      Glad you liked it! When you call the component, just pass the value of the prop as true or false. I have a video on props if you are interested! I recommend in this case using a global state through the context api!

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

    Very simply put

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

    thanks man it worked! : )

  • @mikealejandro3938
    @mikealejandro3938 3 роки тому +1

    Hey pedro, i recently did like a facebook clone with MERN, but the problem i had is that ii couldn't upload anything in real time, like facebook, twitter or all the social media's app do, and it's something that is hard to find in courses, i think it's called web sockets, why don't you make a video about it? it would be asome dude !

    • @PedroTechnologies
      @PedroTechnologies  3 роки тому

      Hey, I made some videos on socket.io! Here is one of them: ua-cam.com/video/zWSvb5t_zH4/v-deo.html

  • @ahmmadawshaf
    @ahmmadawshaf 3 роки тому

    Thank you soo much broo!! I'll subscribe to you for this.
    And also what extensions are you using in your VS code for the font color and icon logos on the directory?

  • @fuelledbycoffeee
    @fuelledbycoffeee 3 роки тому +1

    Thanks pedro!

  • @clarkchen1209
    @clarkchen1209 3 роки тому

    If the route you're redirecting to has been updated, will redirect capture that update? Or will you need to refresh somehow?

  • @aravindakolitha
    @aravindakolitha 3 роки тому

    Thank you sensei. :)

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

    bro your videos are good please show how to reroute to login page if local storage is empty using latest version of react
    and

  • @radojicicugo1105
    @radojicicugo1105 3 роки тому

    Thanks man :)) i love you

  • @tibinsunny
    @tibinsunny 3 роки тому +1

    Finally Found it 😍

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

    good explanatory video.

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

    Somos os melhores na programação

  • @junjietan2668
    @junjietan2668 3 роки тому +1

    React master pedro😎
    Good job! Just wondering would you do any chart library that using react in your tutorial list?
    Thanks!😄

    • @PedroTechnologies
      @PedroTechnologies  3 роки тому +1

      Hahaha thank you for watching! People were requesting me to make a video on chartjs so maybe!

  • @mbfreitas0
    @mbfreitas0 3 роки тому +1

    Obrigado Pedro !!!

  • @rhythmshandlya9307
    @rhythmshandlya9307 3 роки тому

    Such a blessing

  • @ferbal6319
    @ferbal6319 3 роки тому +1

    Thanks you bro !!

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

    When useHistory changes pages, does it get rid of the memory or cache in the browser? For instance, if I have a function call history.push() and then execute a bunch of other code, will the other code continue to execute after the new page loads?

  • @vsemprivet9493
    @vsemprivet9493 3 роки тому

    thank bro!!! really help me 👍👍👍👍👍

  • @kavalisuresh8670
    @kavalisuresh8670 3 роки тому

    Nice video sir. How to validate for through particular user id and password of user?

  • @rilangkishabong1723
    @rilangkishabong1723 3 роки тому +1

    Thanks brother.

  • @audrieannelissedelcidochoa15
    @audrieannelissedelcidochoa15 3 роки тому +1

    Esta cuenta siempre me salva :3
    Gracias!

    • @PedroTechnologies
      @PedroTechnologies  3 роки тому

      Jajajaja de nada. Me alegro que estés disfrutando de los videos

  • @RalucaAvram-k4g
    @RalucaAvram-k4g Рік тому

    Thanks a lot!

  • @sunilkumarkatta9062
    @sunilkumarkatta9062 3 роки тому

    Will the useHistory hook work if we don't use router concept?

  • @phantazzor
    @phantazzor 3 роки тому +1

    Is there a way to do it at once for many routes? Because is you need to redirect and pass authorized all the time it is very redundant

  • @ColdbloodDK
    @ColdbloodDK 3 роки тому

    As an Italian I can understand you better than docs

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

    Rookie question but why do I get blank pages when I refresh my app. I have to kind of restart my app or login again, to navigate within the app. But moment I refresh the page, it's blank. Is it as I haven't implemented useHistory throughout my app.

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

    This works well react router versión < 6, but how this would be with React router V6?

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

    I'm using a component in my router. All my routes has this Header, but I want a single Route to not have it... How can I achieve it?

  • @ramonpaolomaran2253
    @ramonpaolomaran2253 3 роки тому

    Cara, uma pergunta.
    Quando o usuário loga, e eu salvo o token dele, eu mando ele de volta para a página home, só que, o "navegador" eu acho, não entende que ele está logado entende. Eu preciso dar um F5 na página, para dai aparecer a mensagem de usuário logado na página home
    Ou seja, eu preciso dar um reload na página
    Já tentei usar o windown.reload no código do login, porém, não dá certo
    O que eu tenho que fazer para a página Home ser realmente recarregada ?

  • @ranjansapkota7572
    @ranjansapkota7572 3 роки тому +1

    Hey Thanks for the video. But I am getting TypeError: Cannot read property 'push' of undefined for history.push, any idea?

    • @PedroTechnologies
      @PedroTechnologies  3 роки тому

      Did you import the useHistory hook and declare the history variable?

  • @lokmanlife3023
    @lokmanlife3023 3 роки тому +1

    Thank you..

  • @loriedimaano6483
    @loriedimaano6483 3 роки тому

    How about when u logged in, the authorized will set to true?

  • @EnesKab
    @EnesKab 3 роки тому

    For some reason, when i try to use redirect in component as you have showed in the video, i get an error that says redirect can only be used inside the router. Any ideas?

  • @thevloglife105
    @thevloglife105 3 роки тому +1

    I got received error below message like this
    Line 6:19: React Hook "useHistory" is called in function "login" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter react-hooks/rules-of-hooks

  • @andresbustamante972
    @andresbustamante972 3 роки тому

    Ty bro

  • @chiragshah4909
    @chiragshah4909 3 роки тому

    Hey I have a doubt
    How do we display the login data in profile page on clicking submit

  • @sajay96
    @sajay96 3 роки тому

    thank you

  • @shreyaramtirth4360
    @shreyaramtirth4360 3 роки тому

    Thank a lot🙏🙏🙏

  • @dream_t3ch
    @dream_t3ch 3 роки тому

    thanks but ths method how can it be apply for 3 or more pages

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

    Yeah but how can you redirect to external urls like going to facebook?

  • @thevloglife105
    @thevloglife105 3 роки тому +1

    I have use for import {useHistory} from 'react-router-dom' , but there is getting an error, I have not idea what is the error let me know

    • @PedroTechnologies
      @PedroTechnologies  3 роки тому

      Interesting, what error does it give?

    • @thevloglife105
      @thevloglife105 3 роки тому

      @@PedroTechnologies Line 6:19: React Hook "useHistory" is called in function "login" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter react-hooks/rules-of-hooks

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

    it's still not working please help

  • @pirajeeth878
    @pirajeeth878 3 роки тому

    Woooooowwwwwwwwwwwww Perfect...

  • @dgcp354
    @dgcp354 3 роки тому +1

    Can u do tutorial about react lazy and suspense

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

    rat hay minh da lam dc

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

    this only works with functional views. how do you implement a redirect a component?

  • @ocity5905
    @ocity5905 3 роки тому

    thanks

  • @majuladarks.8708
    @majuladarks.8708 2 роки тому +1

    Ótimo vídeo mano, só faltou uma legenda em pt-br.

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

    Super