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

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

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

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

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

Enjoying Konva? Please consider to support the project.