DefinitelyTyped/types/react-d3-graph/react-d3-graph-tests.tsx
Santina Lin 7df1c11046
🤖 Merge PR #44866 react-d3-graph: Add onClickGraph GraphEventCallbacks interface by @santina
* Add onClickGraph GraphEventCallbacks interface

* Modify test
2020-05-22 08:08:34 -07:00

30 lines
905 B
TypeScript

import { Graph, Link, Node } from 'react-d3-graph';
import * as React from 'react';
export class Example extends React.Component {
render(): React.ReactElement {
return (
<div>
<Graph
onClickGraph={() => {}}
id="test"
data={{
nodes: [
{ id: 'node1', labelProperty: 'id' },
{ id: 'node2', name: 'node2Name' },
],
links: [{ source: 'node1', target: 'node2' }],
}}
config={{
node: {
labelProperty: node => node.name || 'No name',
},
}}
/>
<Link />
<Node />
</div>
);
}
}