File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 27
27
"eslint-plugin-react" : " ^7.20.3" ,
28
28
"eslint-plugin-react-hooks" : " ^4.0.5" ,
29
29
"md-insert" : " ^1.0.1" ,
30
- "min-react-env" : " ^1 .0.1 " ,
30
+ "min-react-env" : " ^2 .0.0 " ,
31
31
"prop-types-table" : " ^1.0.0" ,
32
32
"react" : " ^18.0.0" ,
33
33
"react-dom" : " ^18.0.0" ,
Original file line number Diff line number Diff line change 3
3
* https://github.com/troybetz/react-youtube
4
4
*/
5
5
6
+ /* global document */
7
+
6
8
import React from 'react' ;
7
9
import ReactDOM from 'react-dom' ;
8
10
import { act } from 'react-dom/test-utils' ;
9
- import env from 'min-react-env' ;
11
+ import 'min-react-env/install ' ;
10
12
import createYouTube from './createYouTube' ;
11
13
12
- Object . assign ( global , env ) ;
14
+ const reactMajor = parseInt ( ( ReactDOM . version || '16' ) . split ( '.' ) [ 0 ] , 10 ) ;
13
15
14
16
async function render ( initialProps ) {
15
17
const { YouTube, sdkMock, playerMock } = createYouTube ( ) ;
@@ -44,9 +46,9 @@ async function render(initialProps) {
44
46
}
45
47
}
46
48
47
- const div = env . document . createElement ( 'div' ) ;
49
+ const div = document . createElement ( 'div' ) ;
48
50
let root ;
49
- if ( ReactDOM . version . startsWith ( '18' ) || ReactDOM . version . startsWith ( '19' ) ) {
51
+ if ( reactMajor >= 18 ) {
50
52
const { createRoot } = await import ( 'react-dom/client' ) ;
51
53
root = createRoot ( div ) ;
52
54
} else {
You can’t perform that action at this time.
0 commit comments