Skip to content

Commit

Permalink
fix(hooks): useRef improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
dalisoft committed Apr 20, 2022
1 parent 46dacfc commit c3561eb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ export const useState = <T>(initialValue: T): [T, (value: T) => void] => {

return [value, setValue];
};
export const useRef = <T>(
ref: T | null = null,
dependencies: Dependencies
): T => useMemo(() => ({ current: ref }), dependencies);
export const useRef = <T>(ref: T | null, dependencies: Dependencies): T =>
useMemo(() => ({ current: ref ?? null }), dependencies);

0 comments on commit c3561eb

Please sign in to comment.