NorthwoodsSoftware / GoJS

JavaScript diagramming library for interactive flowcharts, org charts, design tools, planning tools, visual languages.
http://gojs.net
Other
7.8k stars 2.86k forks source link

TypeError: a.forEach is not a function #186

Closed gmsy closed 2 years ago

gmsy commented 2 years ago

Just installed gojs and gojs-react as described on the official documentation, However when I copy-pasted the code sample from that same page ("Rendering the component" section), I get a TypeError: a.forEach is not a function (as shown on screenshot).

How can I fix that? Thanks.

error

simonsarris commented 2 years ago

I'm not one of the resident react experts, but that page might be a little out of date compared to the gojs-react-basic example.

Still, when I pasted the code into a new project, changing it only a little, I did not come across this a.forEach issue. Did you add anything else?

WalterNorthwoods commented 2 years ago

It sounds as if you are not passing an Array as the diagram's model's nodeDataArray.

gmsy commented 2 years ago

Thank you guys for the replies. For some reason the example on the official documentation gave me that error, but the gojs-react-basic example did work. Thanks!