mirror of
https://github.com/revoltchat/revite.git
synced 2025-02-23 16:50:56 -05: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>
|
||
|
)
|
||
|
}
|