Last active
July 31, 2020 17:36
-
-
Save thelicato/72653e9746ec0a589907c704c858204f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MyDiagram = () => { | |
// create diagrams schema | |
const [schema, setSchema] = useState(initialSchema); | |
const addNode = () => { | |
var new_node = { | |
//new node data | |
} | |
var new_schema = Object.assign({},schema) | |
new_schema.nodes.push(new_node) | |
setSchema(new_schema) | |
} | |
return ( | |
<div style={{ height: '22.5rem' }}> | |
<button onClick={addNode}>addNode</button> | |
<Diagram schema={schema} onChange={setSchema}/> | |
</div> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment