Closed sim51 closed 1 year ago
Looking forward to this
Take a look here : https://github.com/sim51/react-sigma/blob/main/project/packages/examples/src/views/external.tsx
The example project is what I use to test the dev. But for now there is no documentation about it. Moreover, this feature is not yet published in a release.
Can this approach be used to access node events like onClickNode? The old version of the react sigma module allowed this as shown in the code below which called a function. But I have not seen documentation for this version of the module to get node events like this.
<Sigma graph={data} onClickNode={onClickNode}
}}
cheers
The best way (and for now the only way) to do that is to use the hook useRegisterEvents
in a component that is child of SigmaContainer
.
Take a look at the documentation here : https://sim51.github.io/react-sigma/docs/example/events
The next release of react-sigma
will ship the forward ref feature for the sigma instance.
So you will have a direct access to the sigma instance, and then you will be able to do what ever you want with it.
With this method, you have to know the sigma api, there no react sugar / helper, you have to do everything by yourself. But it allows you to control sigma outside the SigmaContainer
This feature has been released in the v3.1.0
ie. external state