Having trouble changing the cursor while dragging an object? I'm struggling to find a solution to change the cursor properly during dragging.
My setup involves a React component where I attempted to change the cursor without success. Despite my efforts, the cursor remains the same during dragging (stuck as the default crossed circle).
function App() {
const dragTarget = useRef(null);
function dragStartHandler(e) {
dragTarget.current.style.cursor = 'move';
}
function dragEndHandler() {
dragTarget.current.style.cursor = 'auto';
}
return (
<div
draggable
onDragStart={dragStartHandler}
onDragEnd={dragEndHandler}
id="dragTarget"
className="draggable-element"
>
Drag me!
</div>
);
}
Seeking guidance on how to effectively control cursor styles during dragging. Any help is greatly appreciated.
Already tried the suggestions provided in previous answers, but no luck. Screenshots attached below: https://i.sstatic.net/PRvdR.png