score:1

Accepted answer

the solution to your problem would be best solved by changing the shape or your state to something like this:

[
  {
    type: 'konvaimage',
    item: <konvaimage image={image}/>
  },
  {
    type: 'text',
    item: '....'
  },
  ...
]

then you do this:

switch(nodes.type) {
   case 'text':
     ...
   case 'konvaimage':
     ...
   etc...
}

Related Query

More Query from same tag