Buckets:
ktongue/docker_container / fem_tutos /node_modules /@mui /utils /esm /getReactNodeRef /getReactNodeRef.js
| import * as React from 'react'; | |
| /** | |
| * Returns the ref of a React node handling differences between React 19 and older versions. | |
| * It will return null if the node is not a valid React element. | |
| * | |
| * @param element React.ReactNode | |
| * @returns React.Ref<any> | null | |
| * | |
| * @deprecated Use getReactElementRef instead | |
| */ | |
| export default function getReactNodeRef(element) { | |
| if (!element || ! /*#__PURE__*/React.isValidElement(element)) { | |
| return null; | |
| } | |
| // 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in older versions | |
| return element.props.propertyIsEnumerable('ref') ? element.props.ref : | |
| // @ts-expect-error element.ref is not included in the ReactElement type | |
| // We cannot check for it, but isValidElement is true at this point | |
| // https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/70189 | |
| element.ref; | |
| } |
Xet Storage Details
- Size:
- 873 Bytes
- Xet hash:
- 0894058374c6fc534afce29a5e163daac41fd29af89f09174cf663c11ed6de19
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.