ktongue's picture
download
raw
738 Bytes
"use strict";
'use client';
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useLazyRef;
var React = _interopRequireWildcard(require("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)
*/
function useLazyRef(init, initArg) {
const ref = React.useRef(UNINITIALIZED);
if (ref.current === UNINITIALIZED) {
ref.current = init(initArg);
}
return ref;
}

Xet Storage Details

Size:
738 Bytes
·
Xet hash:
de405586c07050021dc87f15d4cb698c755ae874adc76e682c8f49fed271ebfb

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.