A React component to use simply the cytoscape js library.
npm install react-cytoscape
import { ReactCytoscape } from 'react-cytoscape';
<ReactCytoscape containerID="cy"
elements={this.getElements()}
cyRef={(cy) => { this.cy = cy; console.log(this.cy) }}
cytoscapeOptions={{wheelSensitivity: 0.1}}
layout={{name: 'dagre'}} />
Props are same as Cytoscape builder function.
-
containerID
: HTML ID todiv
cytoscape container -
elements
: Object withnodes
andegdes
attributes -
style
: Array of Style object -
layout
: Object withname
of layout attribute.
ReactCytoscape
integrates cola layout and dagre layout. -
styleContainer
: an object ofcss
style -
cyRef
: a callback function to obtain a reference tocytoscape object
-
cytoscapeOptions
: Object with others cytoscape options builder