UNPKG

@wordpress/compose

Version:
21 lines 678 B
/** * Hook that performs a shallow comparison between the previous value of an object * and the new one, if there's a difference, it prints it to the console. * This is useful in performance related work, to check why a component re-renders. * * @example * * ```tsx * function MyComponent(props: Record<string, any>) { * useWarnOnChange(props); * * return "Something"; * } * ``` * * @param object Object which changes to compare. * @param prefix Just a prefix to show when console logging. */ declare function useWarnOnChange(object: Record<string, any> | any[], prefix?: string): void; export default useWarnOnChange; //# sourceMappingURL=index.d.ts.map