How to listen to an event on a canvas shape with React and Konva?

With react-konva you can attach any events to canvas nodes that Konva supports.

To do that you can use onEventName property, like onMouseDown for mousedown, onDragEnd for dragend, etc.

For the full list of events take a look into on() method documentation.

In this demo you see how we are using dragstart and dragend events.