React/19/Replace Act Import

1.0.7Last update Jul 24, 2024
by@Codemod
React
migration

This codemod will replace the usages of TestUtils.act() to use React.act(), introduced in React v19.

Example

Before:

import { act } from 'react-dom/test-utils';
act();

After:

import { act } from "react";
act();

Before:

import * as ReactDOMTestUtils from 'react-dom/test-utils';
ReactDOMTestUtils.act();

After:

import * as React from "react";
React.act();

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now