Blame view

天文台pc/tianwentai-ui/node_modules/@radix-ui/react-use-previous/dist/index.mjs 437 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  // packages/react/use-previous/src/usePrevious.tsx
  import * as React from "react";
  function usePrevious(value) {
    const ref = React.useRef({ value, previous: value });
    return React.useMemo(() => {
      if (ref.current.value !== value) {
        ref.current.previous = ref.current.value;
        ref.current.value = value;
      }
      return ref.current.previous;
    }, [value]);
  }
  export {
    usePrevious
  };
  //# sourceMappingURL=index.mjs.map