index.mjs 746 B

1234567891011121314151617181920212223242526
  1. import {useRef as $8LvvK$useRef, useMemo as $8LvvK$useMemo} from "react";
  2. function $010c2913dbd2fe3d$export$5cae361ad82dce8b(value) {
  3. const ref = $8LvvK$useRef({
  4. value: value,
  5. previous: value
  6. }); // We compare values before making an update to ensure that
  7. // a change has been made. This ensures the previous value is
  8. // persisted correctly between renders.
  9. return $8LvvK$useMemo(()=>{
  10. if (ref.current.value !== value) {
  11. ref.current.previous = ref.current.value;
  12. ref.current.value = value;
  13. }
  14. return ref.current.previous;
  15. }, [
  16. value
  17. ]);
  18. }
  19. export {$010c2913dbd2fe3d$export$5cae361ad82dce8b as usePrevious};
  20. //# sourceMappingURL=index.mjs.map