decord/source/hooks/usePrevValue.tsx

21 lines
487 B
TypeScript
Raw Normal View History

2026-07-30 10:14:41 +00:00
// Module ID: 8329
// Function ID: 8330
2026-07-20 16:05:17 +00:00
// Name: usePrevValue
2026-07-29 08:29:29 +00:00
// Dependencies: [19, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-30 10:14:41 +00:00
// Module 8329 (usePrevValue)
2026-07-29 08:29:29 +00:00
import { useRef } from "noop";
2026-07-23 10:11:24 +00:00
const result = require("set").fileFinishedImporting("hooks/usePrevValue.tsx");
2026-07-20 16:05:17 +00:00
export default function usePrevValue(current) {
const tmp = useRef(null);
const tmp2 = useRef(null);
if (!Object.is(current, tmp2.current)) {
tmp.current = tmp2.current;
tmp2.current = current;
}
return tmp.current;
};