Skip to content

React 16.6 StrictMode: findDOMNode is deprecated in StrictMode #1406

@apepper

Description

@apepper

First of all, thanks for your package. It's quite a help to have it.

I just checked out the latest react 16.6.0 release. They extended APIs in StrictMode, that are now considered deprecated. findDOMNode is now considered deprecated. See https://reactjs.org/blog/2018/10/23/react-v-16-6.html#deprecations-in-strictmode for the full list.

If you add React.StrictMode around Slick you'll get the following console warning:

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

    in div (created by Track)
    in Track (created by InnerSlider)
    in div (created by InnerSlider)
    in div (created by InnerSlider)
    in InnerSlider (created by Slider)
    in Slider (created by ReactSlickDemo)
    in div (created by ReactSlickDemo)
    in StrictMode (created by ReactSlickDemo)
    in ReactSlickDemo

Learn more about using refs safely here:
https://fb.me/react-strict-mode-find-node

See it live on https://codesandbox.io/s/8j39k1pq8. Also see https://fb.me/react-strict-mode-find-node for how to get rid of the warning.

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