Skip to content

Commit c2aa1b9

Browse files
authored
Merge pull request #53 from sgratzl/sgratzl/react_ref
use React refs All tests passed here and in dash-cytoscape, merging#53
2 parents ffff4bb + ca1cf24 commit c2aa1b9

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
"demo": "cross-env NODE_ENV=development webpack-serve webpack.config.js --open --open-path demo.html"
3232
},
3333
"peerDependencies": {
34-
"react": ">=15.0.0",
35-
"react-dom": ">=15.0.0"
34+
"react": ">=15.0.0"
3635
},
3736
"devDependencies": {
3837
"babel-core": "^6.26.0",

src/component.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
import ReactDOM from 'react-dom';
32
import { types } from './types';
43
import { defaults } from './defaults';
54
import Cytoscape from 'cytoscape';
@@ -41,10 +40,11 @@ export default class CytoscapeComponent extends React.Component {
4140
constructor(props) {
4241
super(props);
4342
this.displayName = `CytoscapeComponent`;
43+
this.containerRef = React.createRef();
4444
}
4545

4646
componentDidMount() {
47-
const container = ReactDOM.findDOMNode(this);
47+
const container = this.containerRef.current;
4848

4949
const {
5050
global,
@@ -100,6 +100,7 @@ export default class CytoscapeComponent extends React.Component {
100100
const { id, className, style } = this.props;
101101

102102
return React.createElement('div', {
103+
ref: this.containerRef,
103104
id,
104105
className,
105106
style

0 commit comments

Comments
 (0)