When using a ref, don't forget to add the style property and the unit. (px, %, em). it should look like this :
style
unit
refToMove.current.style.transform = `translateY(${-x}px)`;