fix(react): ReactFlow comp ref type
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect, MouseEvent, ChangeEvent, useCallback } from 'react';
|
||||
import { useState, useEffect, MouseEvent, ChangeEvent, useCallback, useRef } from 'react';
|
||||
import {
|
||||
ReactFlow,
|
||||
MiniMap,
|
||||
@@ -45,6 +45,7 @@ const nodeTypes = {
|
||||
};
|
||||
|
||||
const CustomNodeFlow = () => {
|
||||
const ref = useRef(null);
|
||||
const [nodes, setNodes] = useState<MyNode[]>([]);
|
||||
const onNodesChange: OnNodesChange<MyNode> = useCallback(
|
||||
(changes) =>
|
||||
@@ -165,6 +166,7 @@ const CustomNodeFlow = () => {
|
||||
minZoom={0.3}
|
||||
maxZoom={2}
|
||||
onBeforeDelete={onBeforeDelete}
|
||||
ref={ref}
|
||||
>
|
||||
<MiniMap<MyNode>
|
||||
nodeStrokeColor={(n: MyNode): string => {
|
||||
|
||||
Reference in New Issue
Block a user