diff --git a/src/test-utils.ts b/src/test-utils.ts index 0efc234e..1f0df2cd 100644 --- a/src/test-utils.ts +++ b/src/test-utils.ts @@ -1,7 +1,13 @@ -import { act } from "react"; +import * as React from "react"; +import * as DeprecatedReactTestUtils from "react-dom/test-utils"; + declare global { var IS_REACT_ACT_ENVIRONMENT: boolean; } + +const act = + typeof React.act === "function" ? React.act : DeprecatedReactTestUtils.act; + type Item = { callback: IntersectionObserverCallback; elements: Set;