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

Function Counter

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

Source from the content-addressed store, hash-verified

181
182 it('should flush effects if there are pending effects before `act` call', () => {
183 function Counter() {
184 const [count, setCount] = useState(0);
185 useEffect(() => {
186 setCount(count => count + 1);
187 }, []);
188 return <div>{count}</div>;
189 }
190
191 // Render a component which schedules an effect outside of an `act`
192 // call. This will be scheduled to execute after the next paint as usual.

Callers

nothing calls this directly

Calls 2

useStateFunction · 0.90
useEffectFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…