MCPcopy
hub / github.com/preactjs/preact / CounterButton

Function CounterButton

test-utils/test/shared/act.test.jsx:158–162  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

156
157 it('should flush state updates if there are pending state updates before `act` call', () => {
158 function CounterButton() {
159 const [count, setCount] = useState(0);
160 const increment = () => setCount(count => count + 1);
161 return <button onClick={increment}>{count}</button>;
162 }
163
164 render(<CounterButton />, scratch);
165 const button = scratch.querySelector('button');

Callers

nothing calls this directly

Calls 1

useStateFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…