React · Senior · Question 61 of 75
What does a test warning "An update was not wrapped in act(...)" mean?
- ✓Correct answer: State changed after the test stopped waiting, so assertions may run before React finished updating
- 2The component uses an outdated API
- 3The test file must import
actfromreact-dom
Explanation
Testing Library wraps its helpers in act already. The warning usually means a pending async update - use await findBy... or waitFor instead of synchronous queries.