MCPcopy
hub / github.com/facebook/react / act

Function act

packages/react-dom/src/test-utils/ReactTestUtils.js:13–23  ·  view source on GitHub ↗
(callback)

Source from the content-addressed store, hash-verified

11
12let didWarnAboutUsingAct = false;
13export 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}

Calls 1

errorMethod · 0.65

Tested by 15

renderFunction · 0.40
renderMethod · 0.40
expectClickThruFunction · 0.40
mountedFunction · 0.40
renderFunction · 0.40
renderFunction · 0.40
patchFunction · 0.40
ParentFunction · 0.40
CounterFunction · 0.40
FooFunction · 0.40
ParentFunction · 0.40
ChildFunction · 0.40