mirror of
https://github.com/revoltchat/revite.git
synced 2024-09-20 01:57:12 -04:00
13 lines
329 B
TypeScript
13 lines
329 B
TypeScript
|
import { useState } from "preact/hooks";
|
||
|
|
||
|
const counts: { [key: string]: number } = {};
|
||
|
|
||
|
export default function PaintCounter() {
|
||
|
const [uniqueId] = useState('' + Math.random());
|
||
|
const count = counts[uniqueId] ?? 0;
|
||
|
counts[uniqueId] = count + 1;
|
||
|
return (
|
||
|
<span>Painted {count + 1} time(s).</span>
|
||
|
)
|
||
|
}
|