Add error message to useWhyDidYouUpdate

This commit is contained in:
Oliver Walters 2026-06-29 11:59:03 +00:00
parent 4ad764a2b2
commit 2712375ae9
1 changed files with 4 additions and 0 deletions

View File

@ -9,6 +9,10 @@ export function useWhyDidYouUpdate(name: string, props: any) {
const previousProps = useRef({});
useEffect(() => {
console.error(
'useWhyDidYouUpdate should not be used in production code. It is intended for debugging purposes only.'
);
if (previousProps.current) {
const allKeys = Object.keys({ ...previousProps.current, ...props });
const changedProps: any = {};