UNPKG

figform

Version:
15 lines 559 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useShallowMemo = useShallowMemo; var tslib_1 = require("tslib"); var React = tslib_1.__importStar(require("react")); function useShallowMemo(obj) { var ref = React.useRef(obj); var hasChanged = Object.keys(obj).length !== Object.keys(ref.current).length || Object.keys(obj).some(function (key) { return obj[key] !== ref.current[key]; }); if (hasChanged) { ref.current = obj; } return ref.current; } //# sourceMappingURL=react-hooks.js.map