refactor(examples): use func components

This commit is contained in:
moklick
2019-10-22 17:47:27 +02:00
parent f9399953c6
commit 76ec1d9a7d
3 changed files with 88 additions and 136 deletions
+18 -1
View File
@@ -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