react-konva strictly follows the order of elements in the way that you define them in your render. For more info take a look into the zIndex demo.
react-konva doesn’t support the
But we can use a simple trick and manual Konva methods to move any node into another container on the whole stage.
Such a portal can be useful when you want to temporarily move a node into another container. The common use cases are:
- Move a dragging shape into another layer for better performance
- Show an element on top of other elements, but still keep it deep down in the components tree
Instructions: try to drag a rectangle. You will see that it is visible on top, but in render it is still the first element.