Skip to content

Commit 436fe6d

Browse files
authored
Merge pull request #675 from thebuilder/fix/deprecated-react-dom-act
fix: support old act from react-dom
2 parents a0566eb + 0dbb29c commit 436fe6d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/test-utils.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
import { act } from "react";
1+
import * as React from "react";
2+
import * as DeprecatedReactTestUtils from "react-dom/test-utils";
3+
24
declare global {
35
var IS_REACT_ACT_ENVIRONMENT: boolean;
46
}
7+
8+
const act =
9+
typeof React.act === "function" ? React.act : DeprecatedReactTestUtils.act;
10+
511
type Item = {
612
callback: IntersectionObserverCallback;
713
elements: Set<Element>;

0 commit comments

Comments
 (0)