slider
slider copied to clipboard
findDOMNode is deprecated in StrictMode
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:
- Use a custom Handle as given in the above code
- Open the console in Chrome
OS: Ubuntu 20.04 LTS
This looks like a duplicate of https://github.com/react-component/slider/issues/613 to me
I agree. And it should also be contained in https://github.com/react-component/slider/issues/708.