Hey guys! Welcome back! In this video, I walk you through how useRef works and give examples on how to use it.
If you don't know about useRef, useRef is a React Hook that creates a mutable object, persisting across renders without causing re-renders when modified. It's commonly used to access DOM elements directly or store values that don't affect the component's rendering. The hook returns an object with a current property, initially set to the argument passed to useRef. This current property can be modified, and its value is retained between renders, unlike regular variables that reset on each render.
If you have any questions/comments, please leave them down below!
Thanks for watching!
My Programming Gear:
Keyboard: https://amzn.to/47eLpX4
Laptop: https://amzn.to/4546pyW
Laptop Stand: https://amzn.to/3GOYlZ7
Desk: https://amzn.to/43wmIEt
Monitor: https://amzn.to/42BAaFH
Monitor Arm: https://amzn.to/3NR0APS
Chair: https://amzn.to/42vvKAn
Desk Mat/Mousepad: https://amzn.to/43AhKqj
Microphone: https://amzn.to/45RuQ43
Headphones: https://amzn.to/445sf4R
#Coding // #React // #LearnToCode My Website: https://arpanneupane.com
My GitHub: https://github.com/neupanic