1 | import * as React from 'react';
|
2 |
|
3 | export interface RootRefProps<T = any> {
|
4 | rootRef?: ((instance: T | null) => void) | React.RefObject<T>;
|
5 | }
|
6 |
|
7 | /**
|
8 | * ⚠️⚠️⚠️
|
9 | * If you want the DOM element of a Material-UI component check out
|
10 | * [FAQ: How can I access the DOM element?](https:
|
11 | * first.
|
12 | *
|
13 | * This component uses `findDOMNode` which is deprecated in React.StrictMode.
|
14 | *
|
15 | * Helper component to allow attaching a ref to a
|
16 | * wrapped element to access the underlying DOM element.
|
17 | *
|
18 | * It's highly inspired by <https:
|
19 | * For example:
|
20 | *
|
21 | * ```jsx
|
22 | * import React from 'react';
|
23 | * import RootRef from '@material-ui/core/RootRef';
|
24 | *
|
25 | * function MyComponent() {
|
26 | * const domRef = React.useRef();
|
27 | *
|
28 | * React.useEffect(() => {
|
29 | * console.log(domRef.current);
|
30 | * }, []);
|
31 | *
|
32 | * return (
|
33 | * <RootRef rootRef={domRef}>
|
34 | * <SomeChildComponent />
|
35 | * </RootRef>
|
36 | * );
|
37 | * }
|
38 | * ```
|
39 | *
|
40 | * @deprecated
|
41 | * API:
|
42 | *
|
43 | * - [RootRef API](https:
|
44 | */
|
45 | declare const RootRef: React.ComponentType<RootRefProps>;
|
46 |
|
47 | export default RootRef;
|
48 |
|
\ | No newline at end of file |