Skip to content

Warnings with React StrictMode #45

@aduth

Description

@aduth

react-click-outside's use of findDOMNode triggers a warning when used with React.StrictMode.

https://reactjs.org/docs/strict-mode.html

Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of PopoverDetectOutside which is inside StrictMode. Instead, add a ref directly to the element you want to reference.

("PopoverDetectOutside" is the component wrapped using react-click-outside)

Specific issue:

https://reactjs.org/docs/strict-mode.html#warning-about-deprecated-finddomnode-usage

Looking at the implementation, would it be possible to assign the ref as the result of a createRef, calling the wrappedRef callback during componentDidMount using this.ref.current?

https://reactjs.org/docs/refs-and-the-dom.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions