refactor(examples): use func components
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# :ocean: React Flow
|
||||
|
||||
React library for building node-based flow editors.
|
||||
React library for building node-based graphs.
|
||||
|
||||
# Installation
|
||||
|
||||
@@ -8,6 +8,23 @@ React library for building node-based flow editors.
|
||||
npm install github:wbkd/react-flow
|
||||
```
|
||||
|
||||
# Usage
|
||||
|
||||
This is a very basic example of how to use react-flow. There are more advanced examples in the [example](/example) folder.
|
||||
|
||||
```javascript
|
||||
import React from 'react';
|
||||
import Graph from 'react-flow';
|
||||
|
||||
const elements = [
|
||||
{ id: '1', data: { label: 'Node 1' }, position: { x: 250, y: 5 } },
|
||||
{ id: '2', data: { label: 'Node 2' }, position: { x: 100, y: 100 } },
|
||||
{ id: 'e1-2', source: '1', target: '2', animated: true },
|
||||
];
|
||||
|
||||
const BasicGraph = () => <Graph elements={elements} style={{ width: '100%', height: '100%' }} />;
|
||||
```
|
||||
|
||||
# Props
|
||||
|
||||
- `elements`: array with nodes and edges
|
||||
|
||||
Reference in New Issue
Block a user