import { memo, useState } from 'react' import { createRoot } from 'react-dom/client' import { flushSync } from 'react-dom' import { CELLS, count, glyph, harness } from '../shared/harness.js' let bump: () => void let setAll: (fn: (cells: number[]) => number[]) => void function Counter() { count.renders++ const [n, set] = useState(0) bump = () => flushSync(() => set(v => v + 1)) return } const Cell = memo(function Cell({ value }: { value: number }) { count.renders++ return {glyph(value)} }) function Grid() { count.renders++ const [cells, set] = useState(() => Array.from({ length: CELLS }, () => 0)) setAll = set return