Skip to content
On this page

useWhyDidYouUpdate

Help developers troubleshoot what changes have caused component rerender.

Code demonstration

API

type IProps = Record<string, any>;
useWhyDidYouUpdate(componentName: string, props: IProps): void;
type IProps = Record<string, any>;
useWhyDidYouUpdate(componentName: string, props: IProps): void;

Params

PropertyDescriptionTypeDefault
componentNameRequired, the name of the observation componentstring-
propsRequired, data to be observed (state or props and other data that may lead to rerender)Proxy<object>-

Result

Please open the browser console, you can see the output of the changed observed state or props.

Source

SourceDocsDemo