Spaces:
Sleeping
Sleeping
Download frontend/node_modules/@mui/utils/esm/useLazyRef/useLazyRef.js from sepidnes/pythonic-rag-FastAPIReact: direct link, hf CLI and curl.
- Browser
- Download file 525 Bytes
-
https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/94e32638a275d46bc1ba62feac204fcaaf313da4/frontend/node_modules/%40mui/utils/esm/useLazyRef/useLazyRef.js
- Command line
-
hf download hf://spaces/sepidnes/pythonic-rag-FastAPIReact@94e32638a275d46bc1ba62feac204fcaaf313da4/frontend/node_modules/@mui/utils/esm/useLazyRef/useLazyRef.js
-
curl -L -o useLazyRef.js https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/94e32638a275d46bc1ba62feac204fcaaf313da4/frontend/node_modules/%40mui/utils/esm/useLazyRef/useLazyRef.js
525 Bytes
| 'use client'; | |
| import * as React from 'react'; | |
| const UNINITIALIZED = {}; | |
| /** | |
| * A React.useRef() that is initialized lazily with a function. Note that it accepts an optional | |
| * initialization argument, so the initialization function doesn't need to be an inline closure. | |
| * | |
| * @usage | |
| * const ref = useLazyRef(sortColumns, columns) | |
| */ | |
| export default function useLazyRef(init, initArg) { | |
| const ref = React.useRef(UNINITIALIZED); | |
| if (ref.current === UNINITIALIZED) { | |
| ref.current = init(initArg); | |
| } | |
| return ref; | |
| } |