Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 6968

GoJS with React. store data in the state

$
0
0

@HachimDev wrote:

Hi, I would like to store the model of my diagram to the state of my component and then maybe later to the store
Here is my code :

    myDiagram.addDiagramListener("ExternalObjectsDropped", function(){
      this.saveJson(myDiagram.model.toJson());
      console.log("network : ", myDiagram.model.toJson());
    });

this is called in the renderCanvas method which is called in ComponentDidMount
The console.log works fine but the function saveJson is undefined

Any idea why the "this" is concidered undefinied ?
thanks

Posts: 5

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 6968

Trending Articles