5

I am getting below warning on button click

findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more ab

here is my code https://codesandbox.io/s/zen-cartwright-v5zqy

<button
        onClick={() => {
          messageRef.current && messageRef.current.handleClick();
        }}
      >

HTML

const messageRef = useRef();

<MessageModal
        ref={messageRef}
        message={message.message}
        severity={message.severity}
      />
user944513
  • 9,790
  • 23
  • 109
  • 225
  • Looks like issue with `MuiAlert` from "@material-ui/lab/Alert". – Drew Reese Apr 03 '20 at 05:32
  • 1
    Open an [issue](https://github.com/mui-org/material-ui/tree/master/packages/material-ui-lab) and wait. Fork the repo, fix it and issue a pull request, and wait. Fork the repo, fix it and maintain a local copy. – Drew Reese Apr 03 '20 at 05:48
  • 1
    @user944513 Seems on progress https://github.com/reactjs/rfcs/pull/97 – keikai Apr 03 '20 at 09:12
  • 1
    Does this answer your question? [React DnD: Avoid using findDOMNode](https://stackoverflow.com/questions/40499267/react-dnd-avoid-using-finddomnode) – Zach Aug 14 '20 at 19:42

0 Answers0