useRef is an kind of alternative to useState hook , with useRef you can get an reference to an element and than use the DOM/JS properties to modify it .
You can even call useRef as an tool which is used to apply all the DOM properties as you were doing in Javascript before coming to React.
If you use useRef than this apparoch is called un-controlled components.