Closed sim51 closed 1 year ago
It can be cool to be able to forward the Sigma ref when using the SigmaContainer. This will allow user to control the graph & Sigma outside SigmaContainer tree.
SigmaContainer
Example :
export const ExternalView: FC = () => { const [sigma, setSigma] = useState<Sigma | null>(null); useEffect(() => { if (sigma) { const graph = sigma.getGraph(); graph.addNode("A", { x: 0, y: 0, label: "Node A", size: 10 }); graph.addNode("B", { x: 1, y: 1, label: "Node B", size: 10 }); graph.addEdgeWithKey("rel1", "A", "B", { label: "REL_1" }); } }, [sigma]); return <SigmaContainer ref={setSigma} />; };
Should add an example on the website
It can be cool to be able to forward the Sigma ref when using the
SigmaContainer
. This will allow user to control the graph & Sigma outsideSigmaContainer
tree.Example :