diff --git a/example/src/Validation/index.js b/example/src/Validation/index.js
index 47988e4c..2a46a5d8 100644
--- a/example/src/Validation/index.js
+++ b/example/src/Validation/index.js
@@ -8,53 +8,43 @@ const initialElements = [
{ id: '0', type: 'custominput', position: { x: 0, y: 150 } },
{ id: 'A', type: 'customnode', position: { x: 250, y: 0 } },
{ id: 'B', type: 'customnode', position: { x: 250, y: 150 } },
- { id: 'C', type: 'customnode', position: { x: 250, y:300 } },
+ { id: 'C', type: 'customnode', position: { x: 250, y: 300 } },
];
+const isValidConnection = (connection) => connection.target === 'B';
+
const CustomInput = () => (
<>
Only connectable with B
- connection.target === 'B'}
- />
+
>
);
const CustomNode = ({ id }) => (
<>
- id === 'B'}
- />
+
{id}
- id === 'B'}
- />
+
>
);
const HorizontalFlow = () => {
const [elements, setElements] = useState(initialElements);
- const onConnect = (params) => setElements(els => addEdge(params, els));
+ const onConnect = (params) => setElements((els) => addEdge(params, els));
return (
reactFlowInstance.fitView()}
+ onLoad={(reactFlowInstance) => reactFlowInstance.fitView()}
className="validationflow"
nodeTypes={{
custominput: CustomInput,
- customnode: CustomNode
+ customnode: CustomNode,
}}
/>
);
-}
+};
export default HorizontalFlow;