Skip to content

Bug: React 18.3 warning says to import act from react, only unstable_act exists #28915

Closed
@rexxars

Description

@rexxars

In the newly released 18.3.0 release, if you try to use the act function from react-dom/test-utils, you will get the following warning:

Import act from react instead of react-dom/test-utils

However, the 18.3.0 release only ships unstable_act, not act. The react 19 beta seems to have renamed to act.
I feel the warning should either tell you to import from unstable_act, or the act export should actually exist, even if aliased to unstable_act internally

React version: 18.3.0

Steps To Reproduce

  1. On react + react-dom@18.3.0, import and use act from react-dom/test-utils.
  2. See warning
  3. Try to import act from react@18.3.0

Link to code example: https://codesandbox.io/p/sandbox/intelligent-chandrasekhar-p9xk7h

The current behavior

act does not exist, warning tells you to use it

The expected behavior

act exists, warning tells you to use it OR warning tells you to use unstable_act

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions