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.
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.