2

My sortable item contains a link so when I click on it to drag and drop. Problem is after I drop, it navigates to the link. How can I prevent this?

user17443811
  • 103
  • 3

1 Answers1

4

You can get isDragging from

const { isDragging } = useDraggable({ id });

or

const { isDragging } = useSortable({ id });

and then

<a href={!isDragging ? 'link' : undefined}>...</a>
burtek
  • 2,576
  • 7
  • 29
  • 37
Werthis
  • 557
  • 3
  • 15