UNPKG

@nutui/nutui-react

Version:

京东风格的轻量级移动端 React 组件库,支持一套代码生成 H5 和小程序

21 lines (20 loc) 687 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "default", { enumerable: true, get: function() { return useMemo; } }); var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard"); var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react")); function useMemo(getValue, condition, shouldUpdate) { var cacheRef = _react.useRef({}); if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) { cacheRef.current.value = getValue(); cacheRef.current.condition = condition; } return cacheRef.current.value; }