Skip to content

Instantly share code, notes, and snippets.

@colinfwren
Created September 1, 2024 22:37
Show Gist options
  • Save colinfwren/c174d13f0651b0861a97639737e47c1b to your computer and use it in GitHub Desktop.
Save colinfwren/c174d13f0651b0861a97639737e47c1b to your computer and use it in GitHub Desktop.
const { useRef } = React
const Graph = () => {
const fgRef = useRef();
return <ForceGraph2D
ref={fgRef}
graphData={data}
nodeCanvasObject={nodeCanvasObject}
nodePointerAreaPaint={nodePointerAreaPaint}
cooldownTicks={100}
onEngineStop={() => fgRef.current.zoomToFit(400)}
/>
}
ReactDOM.render(
<Graph />,
document.getElementById('graph')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment