mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-28 19:35:15 +00:00
13 lines
283 B
JavaScript
13 lines
283 B
JavaScript
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;
|
|
} |