import type { MutableRefObject, PropsWithChildren, ReactNode, Ref } from "react"; import { PureComponent } from "react"; /** * Properties for the `FindDomNode` component. */ export type DomRefProps = PropsWithChildren<{ /** * The ref to be populated with the root DOM element of the child component. */ domRef: MutableRefObject | Ref; }>; /** * This component gives the equivalent functionality of ReactDOM.findDOMNode(), * but can be used inside functional components. * * Sample usage: * * ```jsx * // ref.current will be set to the root DOM element of SomeComponent when * // it mounts, and null when it unmounts. * const ref = useRef(); * return ( * * * * ); * ``` * * As with findDOMNode(), use this sparingly. The number of legitimate uses of * this are few and far between. This should only be used when you absolutely * need a ref to a component's DOM (e.g. managing focus, animation), and can't * otherwise get access to it via ref or ref forwarding. Programming against a * component's DOM breaks encapsulation and can lead to brittle code. * * @deprecated This component is deprecated and will be removed in the 5.42.0 * release. Please use ref forwarding instead. */ export default class FindDomNode extends PureComponent { render(): ReactNode; componentDidMount(): void; componentWillUnmount(): void; }