- Published on
useRenderInfo Hook React
![useRenderInfo Hook React](https://user-images.githubusercontent.com/33494971/269602373-9aa20fcb-72ca-49ca-902c-e5866a74bf0e.png)
useRenderInfo Hook React
useRenderInfo Code and Usage
useRenderInfo is a hook to get information about the render of a component.
import { useEffect } from "react";
const useRenderInfo = () => {
useEffect(() => {
console.log("Component has rendered.");
return () => {
console.log("Component will unmount.");
};
}, []);
};
// Usage
const RenderInfoExample = () => {
useRenderInfo();
return (
<div>
<p>This component logs render information to the console.</p>
</div>
);
};