refactor(examples): rename Advanced to CustomNodes, use func component

This commit is contained in:
moklick
2019-10-22 22:37:05 +02:00
parent bd60ad0ecd
commit 02005917f8
14 changed files with 2291 additions and 285 deletions
+3 -3
View File
@@ -11,7 +11,7 @@ const EmptyGraph = () => {
const onElementsRemove = (elementsToRemove) =>
setElements(els => removeElements(elementsToRemove, els));
const onConnect = (params) => setElements(els => addEdge(params, els));
const onAdd = () => {
const addRandomNode = () => {
const nodeId = (elements.length + 1).toString();
const newNode = {
id: nodeId,
@@ -36,10 +36,10 @@ const EmptyGraph = () => {
<Controls />
<button
type="button"
onClick={onAdd}
onClick={addRandomNode}
style={{ position: 'absolute', right: 10, top: 10, zIndex: 4 }}
>
add
add node
</button>
</Graph>
);