Skip to content

Commit

Permalink
fix: support old act from react-dom
Browse files Browse the repository at this point in the history
Fetching `act` from `react-dom/test-utils` is deprecated, but keep support for it for now.
  • Loading branch information
thebuilder committed May 3, 2024
1 parent a0566eb commit 0e95b5d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/test-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
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<Element>;
Expand Down

0 comments on commit 0e95b5d

Please sign in to comment.