Getting Started -> Building a Flow -> Adding Nodes

master
Jason Zhu 2023-05-29 19:39:29 +10:00
parent 310461bd24
commit ba8ab73716
1 changed files with 15 additions and 1 deletions

View File

@ -3,10 +3,24 @@ 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 nodes = [
{
id: '1',
data: { label: 'Hello' },
position: { x: 0, y: 0 },
type: 'input',
},
{
id: '2',
data: { label: 'World!' },
position: { x: 100, y: 100 },
},
];
const Flow = () => { const Flow = () => {
return ( return (
<div style={{ height: 100 }}> <div style={{ height: 100 }}>
<ReactFlow> <ReactFlow nodes={nodes}>
<Background /> <Background />
<Controls /> <Controls />
</ReactFlow> </ReactFlow>