plotly / react-cytoscapejs

React component for Cytoscape.js network visualisations
MIT License
477 stars 68 forks source link

FindDomNode deprecation warning with StrictMode #48

Closed giusdp closed 3 years ago

giusdp commented 4 years ago

I'm using this package in a newly created Reactjs project with create-react-app, which creates the project using React.StrictMode. Because of this I have the following warning:

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://fb.me/react-strict-mode-find-node

It should be updated as the Reactjs docs recommend, I don't think it would be better to remove the StrictMode just for a single component.

cinnabarhorse commented 4 years ago

I'm using NextJS with global TypeScipt and I solved this issue by creating a separate .js file (not .ts or .tsx) for the Cytoscape component and using NextJS's dynamic import to import react-cytoscapejs.

yashap commented 4 years ago

Bump on this one - not a big deal or anything, but seems like @sgratzl has a very small/simple fix?