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
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.
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.
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
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!
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 !
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?
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?
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.
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 ?
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?
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
@@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
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
Correct 😉!
Step 1- import {useNavigate} from 'react-router-dom';
Step 2- let navigate = useNavigate();
Step 3- navigate('/path');
Suggestion, just edit the video and add a picture that contains this comment.
Finally the right resource I was looking for with simple explanations and implementations. Thanks, PedroTech!
Great to hear!
This video was really helpful. I am a beginner and was very confused about this concept. Thank u
Glad it was helpful!
Me too man ,as a beginner I find this authenticated login part is tough
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.
This video was such a great help, and helped me to find, and understand, what I was doing wrong. Thanks a lot. Cheers man!
Cara, vc fez o tutorial que eu tava precisando! Btw, meus projetos tô construindo seguindo o que aprendo aqui kkkk valeu demais!
kkkkkk fico feliz em está ajudando!
Perfect tutorial on perfect time for me! Thank you Pedro!
Great to hear!
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.
This was how I thought things worked but I wasn't sure. Thanks for the clarification.
Really enjoying the constant flow of quality tutorials. I'm hoping your channel blows up soon
I appreciate that! Thank you for the support!
Other really confusion the code. you explain it very sweetly. my problem solve just in 5 mint.
Awesome! Glad I could help!
This short tutorial is so good
You always have the perfect video for whatever I need. Thanks a lot
Happy to help!
Inglês brabo!! Ótimo video Pedrão!!!
Thank you! Simple! useNavigate makes it even SIMPLIER!!!
You are my second react teacher. Thank u so much
First' kon he?
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
Thanks for your vids Pedro ! You're explaining very well, you're the best !! 😁
this is exactly what i was searching for
i love you no bullshit exactly what i needed keep the good work man!!
Hahaha I appreciate the support!
@@PedroTechnologies man, how can I redirect to a URL only one per session? If they go back, will not be redirexted again
I bet this is the best tutorial for redirect!
Love the react tutorials 🙏
Happy to hear you are liking them!
Thank you. I love the way you simply things
Thanks for watching!
You are one of the best brothers...
Thankyou so much for this simple tutorial. Short and well explained
thanks you , i watched 2,3 videos and i wasnt getting it .... now i know what to do
Thanks, PedroTech!
Thank you very much Pedro!
THank you for watching!
Duuuude you are amazing! Thank you so much for this tutorial
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
Dude, I would give you a kiss if I could, thank you so much!!!
short and clear tutorial !
very easy to understand. Thumbs up bro!
Glad to hear that!
Excelente video, Amazing video, Regards from Colombia
Straight to the point 👌🏼
Finally a good explanation
Glad u liked it!
Thank you very much from Colombia!
Glad it helped!
Good stuff Pedro. Thank you.
Glad you liked it!
Thanks for this video,helped me in my work.
Thanks, Brudda! such great content.
I appreciate that!
Thank you so much! This was so helpful!
Yes this video is very helpfull, but i had doubt bro. after filling the form can we redirect the profile page ??
Thank you! so helpful!
thank you so much. This really helped.
Awesome as always 👍😀
Thank you! Cheers!
bro you save my life it work
Thank you so much Pedro)
Really helpful thank you
I Appreciate your Hard Work.
So nice of you! Glad you liked the video!
Thanks a lot, just what I needed :-)
thanks pedro, this tutorial was really helpful. How do I set the prop to true or false in app.js
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!
Very simply put
thanks man it worked! : )
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 !
Hey, I made some videos on socket.io! Here is one of them: ua-cam.com/video/zWSvb5t_zH4/v-deo.html
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?
Thanks pedro!
Thank you for watching!
If the route you're redirecting to has been updated, will redirect capture that update? Or will you need to refresh somehow?
Thank you sensei. :)
bro your videos are good please show how to reroute to login page if local storage is empty using latest version of react
and
Thanks man :)) i love you
Finally Found it 😍
Awesome!
good explanatory video.
Somos os melhores na programação
React master pedro😎
Good job! Just wondering would you do any chart library that using react in your tutorial list?
Thanks!😄
Hahaha thank you for watching! People were requesting me to make a video on chartjs so maybe!
Obrigado Pedro !!!
Fico feliz que você gostou!
Such a blessing
Thanks you bro !!
You're welcome!
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?
thank bro!!! really help me 👍👍👍👍👍
Glad to hear that
Nice video sir. How to validate for through particular user id and password of user?
Thanks brother.
Thank you for watching!
Esta cuenta siempre me salva :3
Gracias!
Jajajaja de nada. Me alegro que estés disfrutando de los videos
Thanks a lot!
Will the useHistory hook work if we don't use router concept?
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
Did you find a way to do this?
As an Italian I can understand you better than docs
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.
This works well react router versión < 6, but how this would be with React router V6?
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?
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 ?
Hey Thanks for the video. But I am getting TypeError: Cannot read property 'push' of undefined for history.push, any idea?
Did you import the useHistory hook and declare the history variable?
Thank you..
Glad you liked it!
How about when u logged in, the authorized will set to true?
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?
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
Can you paste ur code here?
@@PedroTechnologies which one code are you asking?
Ty bro
Hey I have a doubt
How do we display the login data in profile page on clicking submit
thank you
Thank a lot🙏🙏🙏
Always welcome
thanks but ths method how can it be apply for 3 or more pages
Yeah but how can you redirect to external urls like going to facebook?
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
Interesting, what error does it give?
@@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
it's still not working please help
Woooooowwwwwwwwwwwww Perfect...
Can u do tutorial about react lazy and suspense
Yeah!
rat hay minh da lam dc
this only works with functional views. how do you implement a redirect a component?
thanks
Ótimo vídeo mano, só faltou uma legenda em pt-br.
Super