Search code examples
konvajsreact-konvakonvajs-reactjs

using Konva (as opposed to react-konva) in React application - any disadvantages?


When using react-konva in a react web application I'm noting using the JSX tags I do not have direct handles to the various nodes I create on a Layer/Canvas. Then I have to get access to the Layer and use "find" to find the nodes to then modify them.

It would be perhaps easier not using the JSX tags (e.g. Rect, Text etc) and just create them programmatically, that way I would have a handle to the objects to later modify. (e.g. if I drag node A, I want then move node B in real time along with it).

Question - Is there any disadvange to NOT using the react-konvas JSX approach? For example does creating canvas with JSX tags (e.g. for Circle, Rect, Text etc) help reduce the amount of "redraw" effect perhaps?


Solution

  • You can use Konva API directly just fine. It will work.

    Using react-konva is just a lot more natural when you have a React app. As you will use the same paradigm for canvas drawing. Depending on your app size, it can simplify code a lot!