Skip to content

Commit e69306b

Browse files
aryaemami59markerikson
authored andcommitted
Replace the now removed ReactDOM methods
- `ReactDOM.render` and `ReactDOM.unmountComponentAtNode` have been removed in React 19. This commit replaces their usage with `rtl.render` and `root.unmount` as recommended in the React 19 migration guide.
1 parent 355bbfb commit e69306b

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

test/components/Provider.spec.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { Provider, ReactReduxContext, connect } from 'react-redux'
88
import type { Store } from 'redux'
99
import { createStore } from 'redux'
1010

11-
import * as ReactDOM from 'react-dom'
12-
1311
const createExampleTextReducer =
1412
() =>
1513
(state = 'example text') =>
@@ -342,18 +340,16 @@ describe('React', () => {
342340
}
343341
}
344342

345-
const container = document.createElement('div')
346-
347-
// eslint-disable-next-line react/no-deprecated
348-
ReactDOM.render(
343+
const { unmount } = rtl.render(
349344
<Provider store={store}>
350345
<div />
351346
</Provider>,
352-
container,
353347
)
348+
354349
expect(spy).toHaveBeenCalledTimes(0)
355-
// eslint-disable-next-line react/no-deprecated
356-
ReactDOM.unmountComponentAtNode(container)
350+
351+
unmount()
352+
357353
expect(spy).toHaveBeenCalledTimes(1)
358354
})
359355

0 commit comments

Comments
 (0)