Skip to content

Commit b696b72

Browse files
committed
fix(utils): useRefCache returns non-mutable object
1 parent c43cd31 commit b696b72

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/utils/src/useRefCache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MutableRefObject, useEffect, useRef } from "react";
1+
import { useEffect, useRef } from "react";
22

33
/**
44
* This hook allows you to provide anything that should be "cached" and puts it
@@ -11,7 +11,7 @@ import { MutableRefObject, useEffect, useRef } from "react";
1111
* @param cacheable - The cacheable thing that gets updated after each render.
1212
* @returns a mutable ref object containing the current cache.
1313
*/
14-
export function useRefCache<T>(cacheable: T): MutableRefObject<T> {
14+
export function useRefCache<T>(cacheable: T): { readonly current: T } {
1515
const ref = useRef(cacheable);
1616
useEffect(() => {
1717
ref.current = cacheable;

0 commit comments

Comments
 (0)