chore(examples): cleanup

This commit is contained in:
moklick
2024-06-03 16:11:21 +02:00
parent 02250e972d
commit 02d724f16d
2 changed files with 13 additions and 9 deletions

View File

@@ -60,12 +60,13 @@ const ControlledUncontrolled = () => {
const updateNodePositions = () => {
instance.setNodes((nodes) =>
nodes.map((node) => {
node.position = {
x: Math.random() * 400,
y: Math.random() * 400,
return {
...node,
position: {
x: Math.random() * 400,
y: Math.random() * 400,
},
};
return node;
})
);
};
@@ -73,11 +74,12 @@ const ControlledUncontrolled = () => {
const updateEdgeColors = () => {
instance.setEdges((edges) =>
edges.map((edge) => {
edge.style = {
stroke: '#ff5050',
return {
...edge,
style: {
stroke: '#ff5050',
},
};
return edge;
})
);
};

View File

@@ -73,6 +73,8 @@ const HiddenFlow = () => {
setEdges(setHidden(isHidden));
}, [isHidden, setEdges, setNodes]);
console.log(nodes);
return (
<ReactFlow
nodes={nodes}