Blame view

天文台pc/tianwentai-ui/node_modules/react-dnd/dist/hooks/useOptionalFactory.js 368 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  import { useMemo } from 'react';
  export function useOptionalFactory(arg, deps) {
      const memoDeps = [
          ...deps || []
      ];
      if (deps == null && typeof arg !== 'function') {
          memoDeps.push(arg);
      }
      return useMemo(()=>{
          return typeof arg === 'function' ? arg() : arg;
      }, memoDeps);
  }
  
  //# sourceMappingURL=useOptionalFactory.js.map