Get Diagram from console with go-js react

I want to get the Diagram from the console, i found the fromDiv function from the docs but it only seems to work if the Diagram Div has an id. I couldnt find a way to add an id to the ReactDiagram.
Are there other ways to get the Diagram ?

fromDiv(div: Element | string): Also what is Element here if element or string is accepted as parameters.


You can pass either an id or a reference to the HTMLDivElement as the argument to the static function Diagram.fromDiv.

A new undocumented feature is that we have added the “goDiagram” property to the HTMLDivElement of an initialized Diagram, so you don’t even need to call go.Diagram.fromDiv.

Also, we have added the “go” property to that same Div, so that you can get a reference to the namespace – assuming that the namespace exists.

Thanks for the quick response, i managed to get the diagram by reference to the Element.

Okey, that’s great, what version do I need to have to get this new feature ?

All recent versions have that. I don’t remember when we added it as a latent feature.