@equinor/fusion-react-utils
Version:
Helper and util functions for React
16 lines • 672 B
TypeScript
import type { RefObject } from 'react';
type Constructor<T> = {
new (): T;
};
/**
* Extract property names of `custom element`
* NOTE: does not extract events and functions
*/
export declare const extractElementProps: <E extends HTMLElement>(elementClass: Constructor<E>) => Set<keyof E>;
/**
* React will try to `toString` all arguments that are provided.
* This hook will set the property/function to the referenced element programmatically.
*/
export declare const useElementProps: <E extends HTMLElement>(ref: RefObject<E | null>, props?: Partial<Record<string, any>>, propMap?: Set<keyof E>) => void;
export {};
//# sourceMappingURL=useElementProps.d.ts.map