React JS useRef

  • useRef is a React Hook that returns a mutable object with a single property: current.
  • You can use useRef to store a reference to a DOM element, a value that will persist across renders, or to store any other value that you want to persist between renders.

Here’s an example of using useRef to store a reference to a DOM element:

Output:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top