perf: Avoid unmounting of Shell on navigation and thus reduce number of paints (#10646)

Co-authored-by: zomars <[email protected]>
This commit is contained in:
Hariom Balharaandzomars authored and GitHub committed 2023-08-09 15:54:51 -07:00
1 parent 37ce8860b5
commit a49c34e733
17 files changed
+221 -158

No files matched your search

@@ -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>
);
};