@pionjs/pion
Version:
Hooks for web components
27 lines (26 loc) • 781 B
TypeScript
export interface Ref<T> {
current: T | undefined;
value?: T;
}
/**
* Creates a new Ref object compatible with both React-style `.current`
* and lit-html-style `.value` property access.
*
* @function
* @template T
* @param {T} [initialValue]
* @return {Ref<T>}
*/
export declare function createRef<T>(initialValue?: T): Ref<T>;
/**
* Returns a memoized Ref object that persists across renders.
* The ref object is compatible with both React-style `.current`
* and lit-html-style `.value` property access, making it usable
* with lit-html's `ref` directive.
*
* @function
* @template T
* @param {T} [initialValue]
* @return {Ref<T>} Ref object with both `current` and `value` properties
*/
export declare function useRef<T>(initialValue?: T): Ref<T>;