slider icon indicating copy to clipboard operation
slider copied to clipboard

findDOMNode is deprecated in StrictMode

Open cseas opened this issue 4 years ago • 2 comments

Using rc-slider with a custom Handle throws the following error on the console:

findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Handle 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 Handle

Code for reproducing the bug:

import Slider, { Handle } from "rc-slider";
....
<Slider
  handle={({ dragging, ...restProps }: any) => {
    return (
      <Handle dragging={dragging.toString()} {...restProps}>
        <MyIcon width="8px" />
      </Handle>
    );
  }}
  handleStyle={{
    borderColor: "white",
    height: 32,
    width: 32,
    marginTop: -14,
    boxShadow: "0 2px 6px 0 rgba(0, 0, 0, 0.28)",
  }}
  trackStyle={{ backgroundColor: "black" }}
  min={min}
  max={max}
  {...rest}
/>

Steps to reproduce:

  1. Use a custom Handle as given in the above code
  2. Open the console in Chrome

Source code

OS: Ubuntu 20.04 LTS

cseas avatar Feb 14 '21 08:02 cseas

This looks like a duplicate of https://github.com/react-component/slider/issues/613 to me

jnachtigall avatar Mar 04 '21 13:03 jnachtigall

I agree. And it should also be contained in https://github.com/react-component/slider/issues/708.

sylann avatar Apr 30 '21 11:04 sylann