2
0

first commit

This commit is contained in:
2024-08-09 00:39:27 +02:00
commit 79688abe2e
5698 changed files with 497838 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import { useRef } from "react";
/**
* Updates in document the number of times a component has been rendered. Helps in 2 ways. Using it doesn't cause any additional renders.
* - Did the component render when it shouldn't have?
* - Did the component reset its state when it shouldn't have?
*/
export const RenderCounter = ({ label }: { label: string }) => {
const counterRef = useRef(0);
counterRef.current++;
return (
<span>
<span>{label}:</span>
<span>{counterRef.current} </span>
</span>
);
};