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

  1. import { useRef } from 'react';
  2. /**
  3. * Returns a ref that is immediately updated with the new value
  4. *
  5. * @param value The Ref value
  6. * @category refs
  7. */
  8. export default function useUpdatedRef(value) {
  9. var valueRef = useRef(value);
  10. valueRef.current = value;
  11. return valueRef;
  12. }