StrictMode: Warning about deprecated findDOMNode usage
//you can instead pass a ref to your custom component and pass that along to the DOM using ref forwarding
//you can also add a wrapper DOM node in your component and attach a ref directly to it
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.wrapper = React.createRef();
}
render() {
return <div ref={this.wrapper}>{this.props.children}</div>;
}
}
React used to support findDOMNode to search the tree for a DOM node given a class instance.
FindDOMNode only worked if components always return a single DOM node that never changes.