UNPKG

592 BTypeScriptView Raw
1/**
2 * passes {value} to {ref}
3 *
4 * WARNING: Be sure to only call this inside a callback that is passed as a ref.
5 * Otherwise make sure to cleanup previous {ref} if it changes. See
6 * https://github.com/mui-org/material-ui/issues/13539
7 *
8 * useful if you want to expose the ref of an inner component to the public api
9 * while still using it inside the component
10 *
11 * @param ref a ref callback or ref object if anything falsy this is a no-op
12 */
13export default function setRef<T>(
14 ref: React.RefObject<T> | ((instance: T | null) => void) | null | undefined,
15 value: T | null,
16): void;