Greg
Greg

Reputation: 34798

how to access react-konva “stage” or “layer” from event handler?

How would one access the “stage” or “layer” from an event hanlde when using react-konva? (i.e. with JSX)

For example in this example: https://konvajs.org/docs/react/index.html, how would one access stage or layer in the event handler if one wanted to do a “find”, to search for a particular canvas node…

Upvotes: 0

Views: 1754

Answers (1)

lavrton
lavrton

Reputation: 20308

onClick={(e) => {
   const stage = e.target.getStage();
   const layer = e.target.getLayer();
}}

Upvotes: 2

Related Questions