Replace just overwrites the location instead of adding another. So if they go to an invalid url, you can replace the url with a 404 then when they go back it takes them to the last valid url... that's what I've used it for...
@celidee4 жыл бұрын
So glad I found this, been using v4 without the hooks and this implementation is far superior.
@Techsithtube4 жыл бұрын
Thanks for Watching!
@Anas_Alaqeel4 жыл бұрын
Replace can take you to another component or another route but you can't go back, because it replaces the whole location under the hood to only the current location, and this is useful when you want to make a login page and after the user logged in he cannot go back to the login page and there many cases for Replace but this is one of them
@jeromelanteri64694 жыл бұрын
quick and clear. Perfect, thank you, i didn't know for useLocation and useHistory.
@Techsithtube4 жыл бұрын
Glad it helped!
@akashpal96913 жыл бұрын
Awesome video . The comparison between react hooks routing and normal normal is pretty clear here.
@kim92se644 жыл бұрын
so much thanks for this "React router with hooks" awesome tutorial. TC
@Techsithtube4 жыл бұрын
Thanks for watching!
@harshawijendra59035 жыл бұрын
Love your tutorials. Can you do a series on Next.js ? Preferably with Redux. There's not a single solid series on Next. That'll be really helpful if you can.
@brilliantchicken48732 жыл бұрын
Beautifully explained, thank you
@ristolibera12953 жыл бұрын
Very intuitive!
@beksultanomirzak98033 жыл бұрын
Great, I liked your lesson ad explanation thank you
@daliborpetric82884 жыл бұрын
Replace is used for when you login for example, you push user to the Home page, and when he clicks back button in browser, it doesn't returns him to the login page/route. Just like deletes it from history.
@tradewithdani1223 жыл бұрын
tnx dude u solved all of my problems
@KDcoo5 жыл бұрын
Thank you! I really love your tutorials! Very easy straightforward and quick to implement :)
@brahimelmokaouim42993 жыл бұрын
Super react tutorial on youtube
@NeoCoding5 жыл бұрын
Easy and useful as always. Thank you for enlightening.
@digletwithn3 жыл бұрын
Ladies and gel man!
@preethamandakshatha604 жыл бұрын
Could you please do an entire tutorial on use history, like the usage of go, replace, block, the action so on......
@scottsaccenti4 жыл бұрын
This was incredibly helpful. Thanks for this video. Subscribed.
@abeechr4 жыл бұрын
Excellent! I’d love to see you do a video on protected routes with hooks.
@AakashShahFromGoogle5 жыл бұрын
It would be great if you make a unit test with jest video for the same application using hooks you showed here.
@kylehenson22594 жыл бұрын
this tutrial very help me tank you . kepp going
@Techsithtube4 жыл бұрын
Thanks for watching Mostafa. Keep on learning!
@skullcan5 жыл бұрын
Nice video. Thanks!
@kannank33195 жыл бұрын
Thanks for the video. Very much useful
@mickeyvershbow48143 жыл бұрын
Great lesson, thanks so much!
@rizkyiqbal59594 жыл бұрын
U save my life
@AakashShahFromGoogle5 жыл бұрын
This is a great video.
@Techsithtube5 жыл бұрын
Thanks for watching Aakash
@anacatarinagoncalves87143 жыл бұрын
Great explanation, helped me a lot!! Thank you
@dd13mm3 жыл бұрын
Thank you for the video. And how can the useLoccation() be used in a class Component ?
@gwenaeloppitz39724 жыл бұрын
Do you also explain this for typescript? My main struggle is that I find really little tutos for typescript in general and while the advantage it provides is great, it has a lot of pain-in-the ass features for learners
@Techsithtube4 жыл бұрын
I would suggest to understand the concept in javaScript and add the types on the top. so that you are not confused with both. Also in typescript there is type any. so just start with javaScript and type any and as you have more requirement, add more types.
@ajoypatra8824 жыл бұрын
Learn a lot!! It will be helpful if you can create some video on npx-create-library to reuse react components.
@oz99572 жыл бұрын
thank you, that was useful ♥
@roiunger77964 жыл бұрын
Sir, I adore you
@Techsithtube4 жыл бұрын
Thanks for watching!
@adnantariq33465 жыл бұрын
Sooo How would I use something like a useLocation in a CLASS component? and if that answer is, we don't use such hooks in a class, and only in a functional component. What or how do i implement that in a Class component.... Anyways thanks for sharing your insights, love and I mean LOVE this channel :)
@adnantariq33465 жыл бұрын
never mind got my answer "this.props.location.pathname" ty
@vivianeb903 жыл бұрын
Which shortcut did you use here at 5:54 to change all words into "About"?
@rajeevbhosle15803 жыл бұрын
you are awesome
@majjisrinu35185 жыл бұрын
Thanks for the video Sir
@prachigarg66412 жыл бұрын
In WithRouter HOC, how can I get the previous page url? And what will be the previous page URL if I directly hit at my website? How should I handle this edge case?
@blazer5114 жыл бұрын
Hi techsith, what is the best way to pass state to child pages, if the state requires http requests?
@manoharachennuru81514 жыл бұрын
Great content. Thank you
@nahuelaraujo69144 жыл бұрын
Thank you very much sr! Very practical :D
@NoOne-zl4qb5 жыл бұрын
Thanks, just what I was looking for...
@rickyvu23884 жыл бұрын
I don't understand why you need to use fragment/empty tag at 12:20
@prakharmittal62953 жыл бұрын
@techsith how to know the last location generated dynamically without passing it as a state prop on all pages?
@erichkenupp26403 жыл бұрын
Tu é um mito
@gopideveloper43755 жыл бұрын
Awesome. ThanQ
@ek4m814 жыл бұрын
can you do video on difference between hashrouter and browserrouter?
@mahendranath25044 жыл бұрын
precise, to the point, clear, thank you so much,,, can you do a video on best practice in react, I like you content its great, A happy subscriber, can you do a video on reacting tool-kit pls, a concept like createAsyncThunk, createEnityAbopter, i has some goodies like reselect, thunk and state normalization, thanks for the video 👍
@ABHISHEKKUMAR-gp8ls5 жыл бұрын
sir please make a simple website using react hooks.these things are asking by interviewer now a days.. thanks
@Techsithtube5 жыл бұрын
Good to know that that is being asked . I will make tutorial on that.
@rishikumar30764 жыл бұрын
Please do a video on how to use API on react like there is ways axios Or ajax call which are better.
@Techsithtube4 жыл бұрын
Thanks for watching Rishi, I will make a video on AJAX calls.
@ErickG3 жыл бұрын
Does useParams come from react-router or react-router-dom
@saktikantasenapati25084 жыл бұрын
Thanks a lot for this video series. Also can you make some videos on reselect, immer and react-boilerplate ?
@mrmatt89985 жыл бұрын
really handy hooks when we need location and params without withRouter HOC. want to try personally but i haven't change or adopt hooks yet so it can't be done in class components
@dungvu87904 жыл бұрын
Thank you
@quickindiarecipe3 жыл бұрын
I am having issues with react router e.g. I am loading product data from api in my route /products and I want to keep it even If I change route. e.g. if I go back to /about and then come back to /products route the API call in useEffect should not happen again as it has the same data as previous but it keep on fetching the data everytime I visit the the /product route. Although if I use react-query the issue seems to be solved. I don't know how to overcome that issue. Using localstorage seems to be the solution but react-query doesn't use that still manages to keep the results intact.
@shaikkhaja22255 жыл бұрын
Can you please make video on HashRouter.
@priyankaamahour5 жыл бұрын
Thank you so much!
@GMERT3 жыл бұрын
Please can you make a video on linking thank you page to emailjs code. I have been having issues with that for more than 3weeks and no video of that nature on youtube.
@momentswithmanisha4 жыл бұрын
Please make a video about unit testing using jest and enzyme for react application.
@reinvanimschoot33145 жыл бұрын
Mind sharing your vs code setup? Looks really good!
@Techsithtube5 жыл бұрын
github.com/gitmil/new-react-router-with-hooks
@reinvanimschoot33145 жыл бұрын
@@Techsithtube I think you misunderstood me. I'm looking for your VS Code setup, as in the color scheme and plugins etc. Like your settings.json in VS Code. Cheers!
@fernandoaugusto83944 жыл бұрын
Thanks !!
@muhammadqamar22835 жыл бұрын
Make my day :)
@DEV_XO5 жыл бұрын
Nice! :)
@karthicks25815 жыл бұрын
Hi Sir, I have a small doubt, In my application in dashboard page or mapview page or any page while hitting refresh button, i need to redirect to login page, how can i handle page refresh functionality and re render my app components App Component:::: ===================
@tonyxavier35673 жыл бұрын
Switch and useHistory are deprecated, I'm looking for the replacement for withRouter
@Cloud-5774 жыл бұрын
why not use the browser back history ?
@kayan_dev3 жыл бұрын
replace can change z screen to b screen whithot going back
@girishakk32494 жыл бұрын
Sir you didn't explain about Redirect
@carter86794 жыл бұрын
repo for the code?
@carter86794 жыл бұрын
state is undefined when using the useLocation() hook. Anyone else getting this?
@carter86794 жыл бұрын
yeah, followed the tutorial exactly and state is undefined
@hongkongbboy4 жыл бұрын
@8:36 I got 404 (Not Found) instead of "User peter".
@tubingforever Жыл бұрын
Ladies and jellmen
@livingjoke30833 жыл бұрын
Another stingy programming guide that links no GitHub solution. Sweet
@ionitaa4 жыл бұрын
React router is a JOKE(R)! On one project that started way back (in the V2 days) we use the old history on our redux action creators for async redirects. So I guess we're fucked. WE CAN'T UPGRADE THE ROUTER WITHOUT REWRITING VERY ACTION CREATOR THAT USES HISTORY and every component that now has to pass it down to the action creator itself...