soda-material
Version:
A React(>=18) component library that may follow [Material Design 3](https://m3.material.io/components) (a.k.a. Material You)
20 lines (19 loc) • 635 B
TypeScript
/// <reference types="react" />
/**
* Use this to avoid react's immutable ref:
*
* ```ts
* interface RefObject<T> {
* readonly current: T | null;
* }
* // Bivariance hack for consistent unsoundness with RefObject
* type RefCallback<T> = { bivarianceHack(instance: T | null): void }["bivarianceHack"];
* type Ref<T> = RefCallback<T> | RefObject<T> | null;
* type LegacyRef<T> = string | Ref<T>;
* ```
*/
export type ReactRef<T> = React.RefCallback<T> | React.MutableRefObject<T> | null;
/**
* Support callback and object.current
*/
export declare function setReactRef<T>(ref: ReactRef<T> | undefined, value: T): void;