shadcn-ahooks

useWhyDidYouUpdate

Help developers troubleshoot what changes have caused component rerender.

Overview

Help developers troubleshoot what changes have caused component rerender.

Documentation and Examples

Installation

Open in
pnpm dlx shadcn@latest add https://shadcn-ahooks.vercel.app/r/useWhyDidYouUpdate.json
npx shadcn@latest add https://shadcn-ahooks.vercel.app/r/useWhyDidYouUpdate.json
yarn shadcn@latest add https://shadcn-ahooks.vercel.app/r/useWhyDidYouUpdate.json
bun shadcn@latest add https://shadcn-ahooks.vercel.app/r/useWhyDidYouUpdate.json

Help developers troubleshoot what changes have caused component rerender.

Examples

Default usage

API

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)object-

Result

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

On this page