UNPKG

rynex

Version:

A minimalist TypeScript framework for building reactive web applications with no virtual DOM

35 lines 1.15 kB
/** * Rynex Refs and DOM Access * Reference management for DOM elements */ export interface Ref<T = HTMLElement> { current: T | null; } /** * Create a ref object * Used to hold reference to DOM element */ export declare function ref<T = HTMLElement>(initialValue?: T | null): Ref<T>; /** * Use ref hook * Creates and returns a ref object */ export declare function useRef<T = HTMLElement>(initialValue?: T | null): Ref<T>; /** * Forward ref to child component * Allows parent to access child's DOM element */ export declare function forwardRef<P extends Record<string, any>>(component: (props: P, ref: Ref) => HTMLElement): (props: P & { ref?: Ref; }) => HTMLElement; /** * Create callback ref * Executes callback when ref is set */ export declare function callbackRef<T = HTMLElement>(callback: (element: T | null) => void): (element: T | null) => void; /** * Merge multiple refs into one * Useful when you need to forward ref and use it internally */ export declare function mergeRefs<T = HTMLElement>(...refs: (Ref<T> | ((element: T | null) => void) | null)[]): (element: T | null) => void; //# sourceMappingURL=refs.d.ts.map