'Drag and drop dataTransfer.getData is always getting empty string

I am trying do simple drag and drop functionality. I want set some data in on drag via dataTransfer.setData() and get it on drop via dataTransfer.getData() . I am always getting empty string ("").

Please check the link for reproducing example https://codesandbox.io/s/quizzical-lamport-p7cqiv?file=/src/Sample.js

drag and drop and check console

My Environment:

Browser: Chrome

OS: Windows

React UI library



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source