feat(nodes): add nodeOrigin prop

This commit is contained in:
moklick
2022-08-17 11:43:52 +02:00
parent d2d4b76e65
commit ab14be02f4
10 changed files with 75 additions and 7 deletions
+6 -3
View File
@@ -1,4 +1,4 @@
import React, { useState, useEffect, MouseEvent, ChangeEvent } from 'react';
import React, { useState, useEffect, MouseEvent, ChangeEvent, useCallback } from 'react';
import {
ReactFlow,
MiniMap,
@@ -118,8 +118,11 @@ const CustomNodeFlow = () => {
]);
}, []);
const onConnect = (connection: Connection) =>
setEdges((eds) => addEdge({ ...connection, animated: true, style: { stroke: '#fff' } }, eds));
const onConnect = useCallback(
(connection: Connection) =>
setEdges((eds) => addEdge({ ...connection, animated: true, style: { stroke: '#fff' } }, eds)),
[setEdges]
);
return (
<ReactFlow