"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _react = require("react");

/**
 * 保存最新的值在ref中
 *
 * @template T
 * @param {T} value
 * @return {*}
 */
function useLatest(value) {
  var ref = (0, _react.useRef)(value);
  ref.current = value;
  return ref;
}

var _default = useLatest;
exports.default = _default;