Repository navigation
TypeError: React.act is not a function when using @testing-library/react with react@19 #1294
Replies: 1 comment
|
Good afternoon. This may be related to a version mismatch between React and React Testing Library. A few things worth checking:
Could you share the versions of these packages from your project? It would also help to know whether you're using Jest with jsdom or another test environment. One more thing: in the example, make sure the component is actually passed to With the package versions and a complete minimal reproduction, it should be easier to identify the cause. |

Good afternoon. This may be related to a version mismatch between React and React Testing Library.
A few things worth checking:
Make sure you're using
@testing-library/reactv16.1.0 or later, which introduced React 19 support.Check that
reactandreact-domare both installed at compatible versions. Ideally, they should use the same React version.If you're using React Testing Library v16, make sure
@testing-library/domis installed as well.Check whether your package manager has installed multiple versions of React. You can inspect this with:
Could you share the versions of these packages from your project? I…