17 lines
591 B
TypeScript
17 lines
591 B
TypeScript
|
|
/**
|
||
|
|
* passes {value} to {ref}
|
||
|
|
*
|
||
|
|
* WARNING: Be sure to only call this inside a callback that is passed as a ref.
|
||
|
|
* Otherwise make sure to cleanup previous {ref} if it changes. See
|
||
|
|
* https://github.com/mui-org/material-ui/issues/13539
|
||
|
|
*
|
||
|
|
* useful if you want to expose the ref of an inner component to the public api
|
||
|
|
* while still using it inside the component
|
||
|
|
*
|
||
|
|
* @param ref a ref callback or ref object if anything falsy this is a no-op
|
||
|
|
*/
|
||
|
|
export default function setRef<T>(
|
||
|
|
ref: React.RefObject<T> | ((instance: T | null) => void) | null | undefined,
|
||
|
|
value: T | null
|
||
|
|
): void;
|