Page MenuHomec4science

useUpdatedRef.js
No OneTemporary

File Metadata

Created
Fri, Jan 24, 02:23

useUpdatedRef.js

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;
}

Event Timeline