• 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 useEffects 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

  • Type Parameters

    • T

    Parameters

    • callback: (() => T | Promise<T>)
        • (): T | Promise<T>
        • Returns T | Promise<T>

    Returns Promise<T>