Getting Started -> Building a Flow -> Adding an Edge: connect them with a curly edge

master
Jason Zhu 2023-05-29 19:44:25 +10:00
parent eb4286d453
commit 2a52c5ae40
1 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,8 @@ import ReactFlow, { Background, Controls } from 'reactflow';
// we have to import the React Flow styles for it to work // we have to import the React Flow styles for it to work
import 'reactflow/dist/style.css'; import 'reactflow/dist/style.css';
const edges = [{ id: '1-2', source: '1', target: '2' }];
const nodes = [ const nodes = [
{ {
id: '1', id: '1',
@ -20,7 +22,7 @@ const nodes = [
const Flow = () => { const Flow = () => {
return ( return (
<div style={{ height: '100vh' }}> <div style={{ height: '100vh' }}>
<ReactFlow nodes={nodes}> <ReactFlow nodes={nodes} edges={edges}>
<Background /> <Background />
<Controls /> <Controls />
</ReactFlow> </ReactFlow>