Skip to content

Commit 88c2e34

Browse files
committed
bump min-react-env
1 parent 81fb92a commit 88c2e34

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"eslint-plugin-react": "^7.20.3",
2828
"eslint-plugin-react-hooks": "^4.0.5",
2929
"md-insert": "^1.0.1",
30-
"min-react-env": "^1.0.1",
30+
"min-react-env": "^2.0.0",
3131
"prop-types-table": "^1.0.0",
3232
"react": "^18.0.0",
3333
"react-dom": "^18.0.0",

test/util/render.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
* https://github.com/troybetz/react-youtube
44
*/
55

6+
/* global document */
7+
68
import React from 'react';
79
import ReactDOM from 'react-dom';
810
import { act } from 'react-dom/test-utils';
9-
import env from 'min-react-env';
11+
import 'min-react-env/install';
1012
import createYouTube from './createYouTube';
1113

12-
Object.assign(global, env);
14+
const reactMajor = parseInt((ReactDOM.version || '16').split('.')[0], 10);
1315

1416
async function render(initialProps) {
1517
const { YouTube, sdkMock, playerMock } = createYouTube();
@@ -44,9 +46,9 @@ async function render(initialProps) {
4446
}
4547
}
4648

47-
const div = env.document.createElement('div');
49+
const div = document.createElement('div');
4850
let root;
49-
if (ReactDOM.version.startsWith('18') || ReactDOM.version.startsWith('19')) {
51+
if (reactMajor >= 18) {
5052
const { createRoot } = await import('react-dom/client');
5153
root = createRoot(div);
5254
} else {

0 commit comments

Comments
 (0)