Skip to content

Commit 4a57ce2

Browse files
nstepienAman Mahajanamanmahajan7
authored
Add support for React 18 (#2459)
* Add support for React 18 * Usse the new createRoot api to render storybook * Fix variable * Use flushSync to prevent showing partially loaded grid * Only flushSync on the initial render * Don't need flushSync * @testing-library/react@alpha * Update react * graduation from rc * temporarily disable some website pages to fix the build, react-dnd has some incorret react imports * update react-refresh * @testing-library/react@13 * Update react-refresh-webpack-plugin * react-dnd@16 * use `react-dom/client` * fix type issue * fix a couple test warnings * name it ref * fix last test warning * update linaria * mention React 18 in the README Co-authored-by: Aman Mahajan <[email protected]> Co-authored-by: Aman Mahajan <[email protected]>
1 parent 2b402e8 commit 4a57ce2

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
## Features
2020

21-
- [React 16.14+ & 17.0+](package.json) support
21+
- [React 16.14+, 17.0+, and 18.0+](package.json) support
2222
- [Evergreen browsers and server-side rendering](browserslist) support
2323
- Tree-shaking support and only [one npm dependency](package.json) to keep your bundles slim
2424
- Great performance thanks to virtualization: columns and rows outside the viewport are not rendered

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@
5151
"@babel/preset-typescript": "^7.16.7",
5252
"@babel/runtime": "^7.16.7",
5353
"@faker-js/faker": "^6.1.1",
54-
"@linaria/babel-preset": "^3.0.0-beta.17",
55-
"@linaria/core": "^3.0.0-beta.15",
56-
"@linaria/rollup": "^3.0.0-beta.17",
57-
"@linaria/shaker": "^3.0.0-beta.17",
58-
"@linaria/webpack5-loader": "^3.0.0-beta.17",
54+
"@linaria/babel-preset": "^3.0.0-beta.18",
55+
"@linaria/core": "^3.0.0-beta.18",
56+
"@linaria/rollup": "^3.0.0-beta.18",
57+
"@linaria/shaker": "^3.0.0-beta.18",
58+
"@linaria/webpack5-loader": "^3.0.0-beta.18",
5959
"@microsoft/api-extractor": "^7.19.4",
60-
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.4",
60+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
6161
"@rollup/plugin-babel": "^5.3.0",
6262
"@rollup/plugin-node-resolve": "^13.1.3",
6363
"@testing-library/jest-dom": "^5.16.1",
64-
"@testing-library/react": "^12.1.2",
64+
"@testing-library/react": "^13.0.0",
6565
"@testing-library/user-event": "^13.5.0",
6666
"@types/jest": "^27.4.0",
6767
"@types/lodash": "^4.14.178",
@@ -91,12 +91,12 @@
9191
"postcss-loader": "^6.2.1",
9292
"postcss-nested": "^5.0.6",
9393
"prettier": "2.6.2",
94-
"react": "^17.0.2",
94+
"react": "^18.0.0",
9595
"react-contextmenu": "^2.14.0",
96-
"react-dnd": "^15.1.0",
97-
"react-dnd-html5-backend": "^15.1.1",
98-
"react-dom": "^17.0.2",
99-
"react-refresh": "^0.11.0",
96+
"react-dnd": "^16.0.0",
97+
"react-dnd-html5-backend": "^16.0.0",
98+
"react-dom": "^18.0.0",
99+
"react-refresh": "^0.12.0",
100100
"react-router-dom": "^6.2.1",
101101
"rollup": "^2.63.0",
102102
"rollup-plugin-postcss": "^4.0.2",
@@ -108,7 +108,7 @@
108108
"xlsx": "^0.18.0"
109109
},
110110
"peerDependencies": {
111-
"react": "^16.14 || ^17.0",
112-
"react-dom": "^16.14 || ^17.0"
111+
"react": "^16.14 || ^17.0 || ^18.0",
112+
"react-dom": "^16.14 || ^17.0 || ^18.0"
113113
}
114114
}

website/root.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { StrictMode, useState } from 'react';
2-
import { render } from 'react-dom';
2+
import { createRoot } from 'react-dom/client';
33
import { css } from '@linaria/core';
44
import { HashRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
55

@@ -118,9 +118,8 @@ function Root() {
118118
);
119119
}
120120

121-
render(
121+
createRoot(document.getElementById('root')!).render(
122122
<StrictMode>
123123
<Root />
124-
</StrictMode>,
125-
document.getElementById('root')
124+
</StrictMode>
126125
);

0 commit comments

Comments
 (0)