assignRef.d.ts 502 B

123456789101112131415
  1. import { ReactRef } from './types';
  2. /**
  3. * Assigns a value for a given ref, no matter of the ref format
  4. * @param {RefObject} ref - a callback function or ref object
  5. * @param value - a new value
  6. *
  7. * @see https://github.com/theKashey/use-callback-ref#assignref
  8. * @example
  9. * const refObject = useRef();
  10. * const refFn = (ref) => {....}
  11. *
  12. * assignRef(refObject, "refValue");
  13. * assignRef(refFn, "refValue");
  14. */
  15. export declare function assignRef<T>(ref: ReactRef<T>, value: T | null): ReactRef<T>;