mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
22 lines
628 B
TypeScript
22 lines
628 B
TypeScript
import React from "react";
|
|
|
|
export function RenderCounter({ name, children }) {
|
|
const counter = React.useRef(1);
|
|
return (
|
|
<div className="RenderCounter">
|
|
<div className="RenderCounter-meta">
|
|
<div className="RenderCounter-title">
|
|
{name} rendered <strong>{counter.current++} times</strong>
|
|
</div>
|
|
<div className="RenderCounter-lastRender">
|
|
LAST RENDER:{" "}
|
|
{new Intl.DateTimeFormat([], {
|
|
timeStyle: "long",
|
|
}).format(new Date())}
|
|
</div>
|
|
</div>
|
|
<div className="RenderCounter-children">{children}</div>
|
|
</div>
|
|
);
|
|
}
|