Skip to content

Commit 6c3365c

Browse files
authored
Add explanation for async state updates not needing to be wrapped in act()
1 parent 73400e2 commit 6c3365c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/usage/advanced-hooks.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ test('should increment counter after delay', async () => {
132132
})
133133
```
134134

135+
Wrapping `incrementAsync` in `act()` is not necessary since the state updates happen
136+
asynchronously during `await waitForNextUpdate()`. The async utils automatically wrap the waiting
137+
code in the asynchronous `act()` wrapper.
138+
135139
For more details on the the other async utilities, please refer to the
136140
[API Reference](/reference/api#async-utilities).
137141

0 commit comments

Comments
 (0)