# Warning: An update to Component inside a test was not wrapped in act(...)

**Code:** `not wrapped in act` · **Category:** React · **Seen on:** React

A component updated state after the test’s synchronous assertions — async work wasn’t awaited.

## Meaning

Testing Library wraps render and events in act, but async effects (fetches, timers) resolve later. Await the UI changes with findBy*/waitFor.

## Common causes

- Assertions before async data loads
- Unawaited timers or promises
- Tests ending while effects still run

## Quick fix

1. Use await screen.findByText(...) or await waitFor(...)
2. Use fake timers and advance them inside act
3. Mock async dependencies

## Detailed fix by platform

### React

1. `expect(await screen.findByText('Loaded')).toBeInTheDocument();`

## How to diagnose

1. **Update** — Which async work triggers it?
2. **Recent change** — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/react/act-warning-not-wrapped-in-act)
