Skip to content

Commit

Permalink
feat: Update hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
nuintun committed Jun 27, 2024
1 parent 0c1129e commit 320be8b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/hooks/useLatestRef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
* @module useLatestRef
*/

import React, { useMemo, useRef } from 'react';
import { MutableRefObject, useMemo, useRef } from 'react';

/**
* @function useLatestRef
* @description 生成自更新 useRef 对象
*/
export function useLatestRef<T = undefined>(): React.MutableRefObject<T | undefined>;
export function useLatestRef<T = undefined>(): MutableRefObject<T | undefined>;
/**
* @function useLatestRef
* @description 生成自更新 useRef 对象
* @param value 引用值
*/
export function useLatestRef<T>(value: T): React.MutableRefObject<T>;
export function useLatestRef<T>(value: T): MutableRefObject<T>;
/**
* @function useLatestRef
* @description 生成自更新 useRef 对象
* @param value 引用值
*/
export function useLatestRef<T = undefined>(value?: T): React.MutableRefObject<T | undefined> {
export function useLatestRef<T = undefined>(value?: T): MutableRefObject<T | undefined> {
const valueRef = useRef(value);

// https://github.com/alibaba/hooks/issues/728
Expand Down

0 comments on commit 320be8b

Please sign in to comment.