mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 01:15:28 +00:00
Port and re-write icon code.
This commit is contained in:
12
src/lib/PaintCounter.tsx
Normal file
12
src/lib/PaintCounter.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
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>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user