Spaces:
Sleeping
Sleeping
pythonic-rag-FastAPIReact / frontend /node_modules /@mui /utils /legacy /getReactElementRef /getReactElementRef.js
Download frontend/node_modules/@mui/utils/legacy/getReactElementRef/getReactElementRef.js from sepidnes/pythonic-rag-FastAPIReact: direct link, hf CLI and curl.
- Browser
- Download file 840 Bytes
-
https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/56fda741e84da791ee2e6198479f1d5630989f6c/frontend/node_modules/%40mui/utils/legacy/getReactElementRef/getReactElementRef.js
- Command line
-
hf download hf://spaces/sepidnes/pythonic-rag-FastAPIReact@56fda741e84da791ee2e6198479f1d5630989f6c/frontend/node_modules/@mui/utils/legacy/getReactElementRef/getReactElementRef.js
-
curl -L -o getReactElementRef.js https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/56fda741e84da791ee2e6198479f1d5630989f6c/frontend/node_modules/%40mui/utils/legacy/getReactElementRef/getReactElementRef.js
840 Bytes
| import * as React from 'react'; | |
| /** | |
| * Returns the ref of a React element handling differences between React 19 and older versions. | |
| * It will throw runtime error if the element is not a valid React element. | |
| * | |
| * @param element React.ReactElement | |
| * @returns React.Ref<any> | null | |
| */ | |
| export default function getReactElementRef(element) { | |
| // 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in older versions | |
| if (parseInt(React.version, 10) >= 19) { | |
| var _element$props; | |
| return (element == null || (_element$props = element.props) == null ? void 0 : _element$props.ref) || null; | |
| } | |
| // @ts-expect-error element.ref is not included in the ReactElement type | |
| // https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/70189 | |
| return (element == null ? void 0 : element.ref) || null; | |
| } |