I use useRef hook
const secondaryCursor = React.useRef(null);
and use it into useEffect later:
positionRef.current.mouseY = mouseY - secondaryCursor.current.clientHeight / 2; //secondaryCursor.current -> TS2531: Object is possibly 'null'