import React, {useRef, useEffect} from 'react'; import styles from './index.module.less'; import {Graph} from '@antv/x6'; import createFlowChart from './createFlowChart'; interface IProps { onReady: (graph: Graph) => void; } const FlowChart: React.FC = props => { const {onReady} = props; const graphRef = useRef(null); const miniMapRef = useRef(null); useEffect(() => { if(graphRef.current && miniMapRef.current) { const graph = createFlowChart(graphRef.current, miniMapRef.current); onReady(graph); } }, []); return (
); }; export default FlowChart;