How To Smooth Scroll in React - Smooth Scrolling Tutorial

  Рет қаралды 163,575

Code Commerce

Code Commerce

Күн бұрын

Пікірлер: 132
@deborahsanchez9607
@deborahsanchez9607 2 жыл бұрын
I''ve been dealing with this for 3 days and you made it so easy! thank u so much!
@codecommerce
@codecommerce 2 жыл бұрын
You bet! I’m glad you got it sorted out Deborah!
@Amaterasu469
@Amaterasu469 2 жыл бұрын
Thx man, i watch your vids from a while and i just want to say they helped so thanks
@codecommerce
@codecommerce 2 жыл бұрын
Thank you sir!
@PRANAVPRAKASH-y7s
@PRANAVPRAKASH-y7s Ай бұрын
Thanks for this video. Kudos!!
@TheMatriiKz
@TheMatriiKz Жыл бұрын
Thanks so much! redoing my previous portfolio that was Angular into React and ran into this issue.
@codecommerce
@codecommerce Жыл бұрын
Can be pretty easy fix :)
@muhammadjonnazarov146
@muhammadjonnazarov146 2 жыл бұрын
Thanks alot bro, Great video. Very short, simple and clear way of explaining.
@augustine_edeh
@augustine_edeh 9 ай бұрын
Found this super-duper helpful. Thanks man!
@gamingcave4386
@gamingcave4386 9 ай бұрын
Thank you for the video. I have been trying to get this work since last three days.
@anarosol6133
@anarosol6133 8 ай бұрын
Just what I needed. Thanks!!!!!!
@graysonharvey6933
@graysonharvey6933 Жыл бұрын
HUGE thank you! Redoing my portfolio and was stuck on this issue. You demo'd clearly and concisely. Cheers!
@guscarrillo5497
@guscarrillo5497 Жыл бұрын
On that boat as well!
@tikit601
@tikit601 Жыл бұрын
me too
@redYELL0Wblue
@redYELL0Wblue 2 жыл бұрын
Thank you for the video! Very much appreciated!
@codecommerce
@codecommerce 2 жыл бұрын
You’re awesome!
@jpcc1223
@jpcc1223 2 жыл бұрын
thats exactly what i was looking for! thanks man
@codecommerce
@codecommerce 2 жыл бұрын
Thank you Joao
@amannambisan6870
@amannambisan6870 Жыл бұрын
Thank you for this! saved my life!!
@DIEGORAMIREZ-b4e
@DIEGORAMIREZ-b4e 7 ай бұрын
Thank you, you helped me a lot... Greetings from Mexico.. :)
@tanmaysankpal2335
@tanmaysankpal2335 Жыл бұрын
Thank You soo much brooo.....I spent hours on trying various way
@codecommerce
@codecommerce Жыл бұрын
Happy to help
@jonasbjrnpedersen2130
@jonasbjrnpedersen2130 2 жыл бұрын
Thank you so much for this! A great help!
@codecommerce
@codecommerce 2 жыл бұрын
Thank you my friend!
@pedrobrandao23
@pedrobrandao23 2 жыл бұрын
Thank you for the video, helped me a lot! Got one more subscriber
@thesunofodin
@thesunofodin 2 жыл бұрын
Thank you, this helped tremendously!
@em01234567
@em01234567 3 жыл бұрын
Honestly the best video on this topic!
@nguyenthanhphongk17hcm81
@nguyenthanhphongk17hcm81 Жыл бұрын
Thank you, you are my life saver, Ive been struggling with this for 2 days 🤩
@nhuytruong2796
@nhuytruong2796 Жыл бұрын
Thank you very much for this great content. It work!
@anantheswar9048
@anantheswar9048 6 ай бұрын
clean and clear!
@DuminoreDev
@DuminoreDev 8 ай бұрын
Awesome, thank you!
@MehndiBySoukayna
@MehndiBySoukayna 2 ай бұрын
yesssss man thank you!!!!!
@joshuaberrios
@joshuaberrios 2 жыл бұрын
Thanks so much brother. Awesome tutorial!
@codecommerce
@codecommerce 2 жыл бұрын
My pleasure dude!
@omkarpawar7009
@omkarpawar7009 2 жыл бұрын
U made it simple man ur subscribers are well deserved
@fhkodama
@fhkodama 2 жыл бұрын
Great video! :)
@codecommerce
@codecommerce 2 жыл бұрын
Thanks man!
@Coderruhit
@Coderruhit 7 ай бұрын
just wow awesome explain thanks 😍
@nihadyaqublu2359
@nihadyaqublu2359 Жыл бұрын
Thank you very much for this great content. Really helped !
@abdulsamman2229
@abdulsamman2229 Жыл бұрын
mascha Allah, always explained very clear tip top
@codecommerce
@codecommerce Жыл бұрын
Many many thanks
@amatakchannel3735
@amatakchannel3735 2 жыл бұрын
Short and easy to follow thanks
@codecommerce
@codecommerce 2 жыл бұрын
Thanks!
@dewasembiring7286
@dewasembiring7286 3 жыл бұрын
Thanks bro, you made it easy!
@codecommerce
@codecommerce 3 жыл бұрын
Glad it helped!
@quanghuynguyen3356
@quanghuynguyen3356 2 жыл бұрын
very helpful, thank you so much
@developedbyvarun
@developedbyvarun 2 жыл бұрын
Amazing!
@decide5357
@decide5357 2 жыл бұрын
Wow... Really awesome
@ASHOKKUMAR-vx1uh
@ASHOKKUMAR-vx1uh 2 жыл бұрын
Thanks man realy helpful
@julielai2305
@julielai2305 2 жыл бұрын
I've been struggling finding how to scroll to another # without changing the URL. Thank you so much for sharing this!
@codecommerce
@codecommerce 2 жыл бұрын
You're welcome!
@ubraun07
@ubraun07 2 жыл бұрын
amazing content!
@codecommerce
@codecommerce 2 жыл бұрын
Thank you my friend!
@devfren
@devfren 2 жыл бұрын
so good thankyou!
@codecommerce
@codecommerce 2 жыл бұрын
Thank you!
@afe5953
@afe5953 2 жыл бұрын
Thank you. very short and concise explanations I like it.
@pete531
@pete531 Жыл бұрын
Hi, this works only second time click after fresh page reload. on the initial click the offset will be messed up but on second click perfect
@rafihasan4061
@rafihasan4061 2 жыл бұрын
Thanks for the video...Thanks a lot
@codecommerce
@codecommerce 2 жыл бұрын
Thanks dude!
@karankhaira8497
@karankhaira8497 3 ай бұрын
Thanks man.
@Sahrawiyun
@Sahrawiyun 3 жыл бұрын
Another way of achieving this in modern browsers is to set the css scroll-behavior of the html/body to smooth.
@codecommerce
@codecommerce 3 жыл бұрын
Thank you for the feedback - I will definitely try this. :)
@julianafb1245
@julianafb1245 3 жыл бұрын
BOOM! Worked, without changing anything in my code. Thank you!
@s1art7
@s1art7 2 жыл бұрын
@@kalahari8295 u need set important!, because the browser have a default scroll-behavior
@paschalokafor9043
@paschalokafor9043 Жыл бұрын
It works but it will keep reloading your page which u dont need in your react app since it is a Single Page App
@MegaMetallica4ever
@MegaMetallica4ever Жыл бұрын
Thank you so much for this video, but can you tell me how to make a path display in the url. I have no problem achieving all of this when I have a multipage app.
@fatimaiqra2169
@fatimaiqra2169 7 ай бұрын
thanks a lot!
@truewisdom1123
@truewisdom1123 10 ай бұрын
Thanks alot ❤
@azeezabass288
@azeezabass288 3 ай бұрын
You really saved my ass today
@smartfastplan2188
@smartfastplan2188 2 жыл бұрын
Thank you so much sir
@CanaldoSiloks
@CanaldoSiloks Жыл бұрын
Thank u man
@romariojs94
@romariojs94 2 жыл бұрын
Thanks alot!
@codecommerce
@codecommerce 2 жыл бұрын
You're welcome!
@mustangboy3533
@mustangboy3533 11 ай бұрын
Thanks 😊❤
@christeneyeshua4559
@christeneyeshua4559 2 жыл бұрын
this helped a lot Tq
@ygaaaoo
@ygaaaoo 2 жыл бұрын
thanks my brother
@shubha.tshubha.t8997
@shubha.tshubha.t8997 Жыл бұрын
THUMBS UP
@vijayvj5490
@vijayvj5490 2 жыл бұрын
really good one help full for me 🌹🌹🌹🌹🌹
@codecommerce
@codecommerce 2 жыл бұрын
Thank you!
@nedagholami374
@nedagholami374 2 жыл бұрын
thanks. very good
@anantjain9679
@anantjain9679 7 ай бұрын
can we change the route on scrolling like active nav items
@nicolassuarez2933
@nicolassuarez2933 Жыл бұрын
Outstanding! How to scroll on page load without a click? useEffect maybe? thanks!
@escuderomdz
@escuderomdz Жыл бұрын
I used ' const handleWindowsLoad = () => { scroll.scrollToTop(); setActiveSection('home'); }; window.addEventListener('load', handleWindowsLoad);' Maybe this work for you too
@fakhruddinshovon8385
@fakhruddinshovon8385 Жыл бұрын
really that's nice
@Tech_legend-gd3fx
@Tech_legend-gd3fx Ай бұрын
How did u add the tab indicator to the page?
@Adam-vm6tc
@Adam-vm6tc 2 жыл бұрын
Thank you I've been working on this for 3 days and also trying to get ugly hash out of the url with the link. I had no idea this package existed.
@Nilesh-y3b
@Nilesh-y3b Жыл бұрын
Thanks i understand
@jeckjonny6448
@jeckjonny6448 5 ай бұрын
Hello, thank you very much for the video. There is a question, how can I make this approach so that when the page is reloaded, the scroll will automatically go to the top and not be saved in the active section of the page?
@cristiandanielherrera4349
@cristiandanielherrera4349 2 жыл бұрын
Very good
@PeriklesPeriklesoglu
@PeriklesPeriklesoglu Жыл бұрын
thank you
@kedarmakode5664
@kedarmakode5664 Жыл бұрын
Hi, I created react app using vite and i am using tailwindcss for styling. I followed your tutorial still its not working. I even tried with tailwind class for smooth scrolling. Can anyone please help
@farhana5499
@farhana5499 11 ай бұрын
I don't know why my scroll element is weird. it keeps scrolling to the bottom of the clicked element, instead of showing it from the top ;(. Please help...
@Rob-J-BJJ
@Rob-J-BJJ Жыл бұрын
whenever I hover over the button the mouse icon turns into the typing icon how do I fix this
@flavio5693
@flavio5693 Жыл бұрын
can you make a project with React and GraphQL? maybe a CRUD project with backend end React Typescript?
@codecommerce
@codecommerce Жыл бұрын
That would be cool
@festuskoech6612
@festuskoech6612 2 жыл бұрын
I came, found the source code, I hit the like button, subscribe button... and byeeeeeee! Thanks!
@codecommerce
@codecommerce 2 жыл бұрын
Glad to help dude!!
@ArthurBielenberg
@ArthurBielenberg Жыл бұрын
Спасибо большое, Клинт 🙏
@venkateshjajula5711
@venkateshjajula5711 2 жыл бұрын
I got my solution here ! Tq
@codecommerce
@codecommerce 2 жыл бұрын
Awesome dude!
@cjt9150
@cjt9150 3 жыл бұрын
Thanks, subscribed & liked, the one thing i want to know, how to use this react-scroll with react-router-dom v6, both have Link tag??, kindly give a solution
@codecommerce
@codecommerce 3 жыл бұрын
I would advise using only one feature on a specific page. This would clear up that issue.
@souloomonkey1360
@souloomonkey1360 2 жыл бұрын
You can import Link as LinkRouter for example it will just re-name it .
@khalediman9740
@khalediman9740 8 ай бұрын
Thank you for the helpful video you've made. However, I have an issue with hiding the Id from the URL, I mean when I navigate to a specific section inside the same page I don't want the section Id to appear after the localhost:3000, like for example localhost:3000/#About. I've tried to use the hashSpy from react-scroll library, however it didn't' work, so can someone help me with that?
@pratik1439
@pratik1439 Жыл бұрын
thanks sir😊😊😊😊😊😊😊😊😊😊
@yuutotokuda4309
@yuutotokuda4309 2 жыл бұрын
Thank you for the great video. I have one question. I am creating header that jumps to desired contents with the link in header, but I have no idea how to make the header component responsive. I am using react-bootstrap and I have already made header with it. I would like to know how to make the header made in bootstrap with react-scroll.
@frontendwithsalimi
@frontendwithsalimi Жыл бұрын
Is this work also when i click on the link When i click on the link i go down to the section and the active change depending on it?
@tomasburian6550
@tomasburian6550 2 жыл бұрын
Thor himself has descended from Asgard to teach us code! Works great, thanks a lot. So if I got this right, it can't handle switching to another page & then scroll?
@codecommerce
@codecommerce 2 жыл бұрын
HAHA so awesome- thanks dude! That's a great question - I bet we can swing that! I'll play around with it.
@ДмитроКвітчатий
@ДмитроКвітчатий Жыл бұрын
thx
@devrook
@devrook 2 жыл бұрын
What if you want to use { Link } from react-router-dom as well? It gives errors with the two imports being the same
@bowmasterish
@bowmasterish 2 жыл бұрын
I imagine you'll probably have to import one using the 'as' keyword to change the name of your import
@m__link6499
@m__link6499 Жыл бұрын
I Ve tried to use it with Next js but it seems like there is a conflict with the Link component from Next js…How can I implement it in Next Js please?
@RideorDyna
@RideorDyna Жыл бұрын
What would I do if I have a contact page that is separate from the home page? I want to navigate to certain sections on the home page from the contact page.
@gauravjaiswal7296
@gauravjaiswal7296 Жыл бұрын
use react router dom library for ur code
@s1art7
@s1art7 2 жыл бұрын
hi, why not use the property css. scroll-behavior: smooth;? good practices? but this package doesn't change the url, thats perfect for single page app, like a portfolio maybe... thx
@codecommerce
@codecommerce 2 жыл бұрын
You’re right :)
@escuderomdz
@escuderomdz Жыл бұрын
Hello! Thanks for this, it's great! But I have a problem because, for example, if I am in the 'demo' section and I click on the 'home' section, the css style for the 'active' class is applied on top of 'demo', then 'testimonials', then ' about' and then 'home', but the idea is that the 'active' class applies only to the section I click on. Do you know what I'm doing wrong or what is the solution?
@kunwarpreetsingh8314
@kunwarpreetsingh8314 8 ай бұрын
why it's not working on my website
@zeddscarlxrd4331
@zeddscarlxrd4331 2 жыл бұрын
ur such amazing
@dominnumb6367
@dominnumb6367 2 жыл бұрын
Hey man! Really nice video, I just have one question. I need to do automatic scrolling if I get new message. I handle to get new div with special ID, that's all good. But how I can make for example function, and everytime I will run it, It will do automatic that ? I hope you understand what I mean and Thank you!
@codecommerce
@codecommerce 2 жыл бұрын
I'm sorry, I don't think I am 100% following. Are you referring to an onClick event that could trigger a function to scroll to a specific part of the page?
@zappist751
@zappist751 Жыл бұрын
THANK YOU LORD THANK YOU JESUS AND THANK YOU SIRRRR
@codecommerce
@codecommerce Жыл бұрын
Thank you! Also you can use “scroll-behavior” in CSS :)
@CrazyGunner782
@CrazyGunner782 Жыл бұрын
3:40
@vigneshkundar467
@vigneshkundar467 2 жыл бұрын
```Just use this one line of css``` inside public/index.html html { scroll-behavior: smooth; }
@pedrovictorsaraiva8705
@pedrovictorsaraiva8705 2 жыл бұрын
Doesn't work in React
@Salmankhan_38827
@Salmankhan_38827 6 ай бұрын
Hah just apply scroll-behaviour : smooth; in css and you are done.
@ouailtayarth4012
@ouailtayarth4012 2 жыл бұрын
When you click on each nav bar to navigate to a specific section, the link renders localhost:3000/#about. It didn't change the name of that section localhost:3000/#demo. What changes should be made to fix that? Thanks for your efforts Man!!
@mohamed404eg
@mohamed404eg Жыл бұрын
// go to section if (window.location.pathname === "/Projects") { console.log( document.querySelector("#Projects").getBoundingClientRect().top ); } window.scrollTo({ top: document.querySelector("#Projects").getBoundingClientRect().top, left: 0, behavior: "smooth", }); }
@NeerajKumar-wk4qq
@NeerajKumar-wk4qq Жыл бұрын
Thank you so much sir
@fhrmk
@fhrmk Жыл бұрын
thank you
Smooth Scroll to an Element in React
8:38
Colby Fayock
Рет қаралды 41 М.
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
On-Scroll Reveal Animation with React & Framer Motion
10:39
Tom Is Loading
Рет қаралды 187 М.
Use React to Scroll to Specific Section on Your Website
19:34
Program With Abu
Рет қаралды 53 М.
How To Smooth Scroll In React
13:49
Yash Patel
Рет қаралды 30 М.
How to use Framer Motion in React JS Website
5:55
Md Al Mamun
Рет қаралды 26 М.
Easy React Animations Unlocked! You have to check out this library
12:03
The Parallax Effect // 5 Minute WebDev Project
5:01
Fireship
Рет қаралды 655 М.
Subtle, yet Beautiful Scroll Animations
5:04
Beyond Fireship
Рет қаралды 1,8 МЛН
Framer Motion (React) - The Basics
17:07
rithmic
Рет қаралды 45 М.
Coding a FULL App with AI (You Won't Believe This)
15:19
Creator Magic
Рет қаралды 390 М.
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН