main
js 23 lines 666 Bytes
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @noflow
8 */
9
10 import * as React from 'react';
11
12 let didWarnAboutUsingAct = false;
13 export function act(callback) {
14 if (didWarnAboutUsingAct === false) {
15 didWarnAboutUsingAct = true;
16 console.error(
17 '`ReactDOMTestUtils.act` is deprecated in favor of `React.act`. ' +
18 'Import `act` from `react` instead of `react-dom/test-utils`. ' +
19 'See https://react.dev/warnings/react-dom-test-utils for more info.',
20 );
21 }
22 return React.act(callback);
23 }