feat(nodes): add helper functions to iterate over child nodes

This commit is contained in:
Christopher Möller
2021-10-21 11:53:44 +02:00
parent 9350884836
commit 9ad894d2df
7 changed files with 157 additions and 96 deletions
+2 -2
View File
@@ -13,6 +13,7 @@ import ReactFlow, {
EdgeChange,
OnLoadParams,
Connection,
nodeHelper,
} from 'react-flow-renderer';
const onNodeDragStop = (_: MouseEvent, node: Node) => console.log('drag stop', node);
@@ -79,9 +80,8 @@ const BasicFlow = () => {
const toggleClassnames = () => {
setNodes((nds) => {
return nds.map((n) => {
return nodeHelper(nds).map((n) => {
n.className = n.className === 'light' ? 'dark' : 'light';
return n;
});
});