refactor: use existing d3Selection to get the element ref

This commit is contained in:
GeoffreyLiu
2022-11-14 08:30:09 +08:00
parent 1993734a99
commit 23aa8bb270
9 changed files with 15 additions and 92 deletions
@@ -1,12 +0,0 @@
import { useEffect, useRef } from 'react';
import ReactFlow from 'reactflow';
export function RefReactFlow({ onGetRef }: { onGetRef: (element: HTMLDivElement | null) => void }) {
const ref = useRef<HTMLDivElement | null>(null);
useEffect(() => {
onGetRef(ref.current);
}, []);
return <ReactFlow ref={ref} />;
}