react-draggable icon indicating copy to clipboard operation
react-draggable copied to clipboard

Getting Warnings in new React version.

Open sumitdhakadjobma opened this issue 1 year ago • 8 comments

Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of DraggableCore 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 DraggableCore (http://localhost:3000/static/js/vendors-node_modules_react-draggable_build_cjs_cjs_js.chunk.js:1156:5) at Draggable (http://localhost:3000/static/js/vendors-node_modules_react-draggable_build_cjs_cjs_js.chunk.js:447:5) at VoiceCommand (http://localhost:3000/static/js/src_modules_Interview_FirstTheme_VoiceCommand_VoiceCommand_js.chunk.js:35:5) at Suspense at VoiceCommand ....... ....... ....... (hide content)

sumitdhakadjobma avatar Jul 24 '23 06:07 sumitdhakadjobma

While what you say is true I also get that error. You can also just drop the strict and just use the <App>. It cleared the problem for me.

ReactDOM.createRoot(document.getElementById("root")).render(
    <App />
);

Instead of

ReactDOM.createRoot(document.getElementById("root")).render(
   <React.Strict>
    <App />
   </React.Strict>
);

BrianAA avatar Aug 06 '23 15:08 BrianAA

While what you say is true I also get that error. You can also just drop the strict and just use the . It cleared the problem for me.

ReactDOM.createRoot(document.getElementById("root")).render(
    <App />
);

Instead of

ReactDOM.createRoot(document.getElementById("root")).render(
   <React.Strict>
    <App />
   </React.Strict>
);

This is a bad practise since developers use StrictMode for testing. Any other solutions?

z89 avatar Aug 08 '23 09:08 z89

@sumitdhakadjobma @z89 check out this issue: https://github.com/react-grid-layout/react-draggable/issues/693

Dream4ever avatar Aug 20 '23 15:08 Dream4ever

+1

SiddHyper avatar Oct 04 '23 08:10 SiddHyper

+1

No need to type "+1", just vote with the the icon on the original post. This way, devs can search and sort for issues.

designbyadrian avatar Oct 31 '23 14:10 designbyadrian

still an issue

gabrielyotoo avatar Feb 07 '24 23:02 gabrielyotoo

As answered in #693, this is resolved by passing in a node ref: https://github.com/react-grid-layout/react-draggable/blob/master/CHANGELOG.md#440-may-12-2020

jmw182 avatar Mar 26 '24 15:03 jmw182

passing in a nodeRef does not always fix this issue, I think

  findDOMNode(): ?HTMLElement {
    return this.props?.nodeRef?.current ?? ReactDOM.findDOMNode(this);
  }

should become

  findDOMNode(): ?HTMLElement {
    return this.props?.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this);
  }

becaus the problem is that nodeRef's current value isnt always set yet when findDOMNode is called

yelvert avatar Apr 14 '24 16:04 yelvert