You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
283 B

import { useRef } from 'react';
/**
* Returns a ref that is immediately updated with the new value
*
* @param value The Ref value
* @category refs
*/
export default function useUpdatedRef(value) {
var valueRef = useRef(value);
valueRef.current = value;
return valueRef;
}