# Function act

- act(callback): void

- Wrap any code rendering and triggering updates to your components into `act()` calls.

  Ensures that the behavior in your tests matches what happens in the browser more closely by executing pending `useEffect`s before returning. This also reduces the amount of re-renders done.

  #### Parameters

  - callback: (() => VoidOrUndefinedOnly)

    A synchronous, void callback that will execute as a single, complete React commit.

    - - (): VoidOrUndefinedOnly

      - #### Returns VoidOrUndefinedOnly

  #### Returns void

  #### See

  https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2141
- act<T>(callback): Promise<T>

- #### Type Parameters

  - T

  #### Parameters

  - callback: (() => T | Promise<T>)
    - - (): T | Promise<T>

      - #### Returns T | Promise<T>

  #### Returns Promise<T>

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2142