Nothing Special   »   [go: up one dir, main page]

DEV Community

Cover image for useRef in react for beginners
Devi
Devi

Posted on

useRef in react for beginners

UseRef will create a reference of a react element, by using that we can mutate the DOM element or a value that is used across the component. Also, we can store some data and that won’t cause a re-render on update.

Steps to use UseRef Hook:

step 1: import it from react

step2: declare it as a ref variable

step 3:pass the ref as an attribute to the JSX .

Top comments (0)