I\'m trying to adapt the code below to use react useRef as opposed to using document.querySelector(selector) as HTMLElement; as it\'s not the best prac
useRef
document.querySelector(selector) as HTMLElement;