Getting Started -> Building a Flow -> Adding Nodes
parent
310461bd24
commit
ba8ab73716
16
src/App.tsx
16
src/App.tsx
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue