Blame view

天文台pc/tianwentai-ui/node_modules/@mui/utils/useOnMount/useOnMount.js 709 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  "use strict";
  'use client';
  
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.default = useOnMount;
  var React = _interopRequireWildcard(require("react"));
  const EMPTY = [];
  
  /**
   * A React.useEffect equivalent that runs once, when the component is mounted.
   */
  function useOnMount(fn) {
    // TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- no need to put `fn` in the dependency array
    /* eslint-disable react-hooks/exhaustive-deps */
    React.useEffect(fn, EMPTY);
    /* eslint-enable react-hooks/exhaustive-deps */
  }