plotly / react-cytoscapejs

React component for Cytoscape.js network visualisations
MIT License
470 stars 69 forks source link

findDOMNode is deprecated in StrictMode #96

Closed ThomasThelen closed 2 years ago

ThomasThelen commented 2 years ago

I found the following error in the console and tracked it down to react-cytoscapejs.

 state = {
    w: 0,
    h: 0,
    elements: []
  }

  render() {
    return (
      <div className="home-body">
        <div className="home-graph">
        <CytoscapeComponent
            elements={this.state.elements}
        />
   )
}
react-dom.development.js:86 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of t which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node
    at div
    at t (http://localhost:3000/static/js/bundle.js:102627:10)
    at div
    at div
    at Home (http://localhost:3000/main.3b759290fa841003e5d5.hot-update.js:30:5)
    at Routes (http://localhost:3000/static/js/bundle.js:55262:5)
    at div
    at div
    at Router (http://localhost:3000/static/js/bundle.js:55195:15)
    at BrowserRouter (http://localhost:3000/static/js/bundle.js:54004:5)
    at App
TheAfroOfDoom commented 2 years ago

This is fixed by PR https://github.com/plotly/react-cytoscapejs/pull/53, but it is not yet pushed to the npm registry.

I fixed it in my local project by pointing the package to that commit: yarn add https://github.com/plotly/react-cytoscapejs#ca1cf24c01af69a96f4002e1adc9ddae44b67ce5.

alexcjohnson commented 2 years ago

v2.0.0 published last week contains this fix. Apologies for the confusion and delay.