From 8b21029f9dcd1a63e8b58f3d54cef12c53ebef53 Mon Sep 17 00:00:00 2001 From: Shahriar Shojib Date: Mon, 4 Apr 2022 16:24:42 +0600 Subject: [PATCH] chore(create-vite-app): upgrade react to 18 (#7597) Co-authored-by: Alec Larson <1925840+aleclarson@users.noreply.github.com> --- .../create-vite/template-react-ts/package.json | 14 +++++++------- .../create-vite/template-react-ts/src/main.tsx | 9 ++++----- packages/create-vite/template-react/package.json | 10 ++++++---- packages/create-vite/template-react/src/main.jsx | 9 ++++----- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/create-vite/template-react-ts/package.json b/packages/create-vite/template-react-ts/package.json index 00f99c8669d660..c08d472dca7477 100644 --- a/packages/create-vite/template-react-ts/package.json +++ b/packages/create-vite/template-react-ts/package.json @@ -8,14 +8,14 @@ "preview": "vite preview" }, "dependencies": { - "react": "^17.0.2", - "react-dom": "^17.0.2" + "react": "^18.0.0", + "react-dom": "^18.0.0" }, "devDependencies": { - "@types/react": "^17.0.33", - "@types/react-dom": "^17.0.10", - "@vitejs/plugin-react": "^1.0.7", - "typescript": "^4.5.4", - "vite": "^2.9.0" + "@types/react": "^17.0.43", + "@types/react-dom": "^17.0.14", + "@vitejs/plugin-react": "^1.3.0", + "typescript": "^4.6.3", + "vite": "^2.9.1" } } diff --git a/packages/create-vite/template-react-ts/src/main.tsx b/packages/create-vite/template-react-ts/src/main.tsx index 606a3cf44ec02b..4a1b15096e15b1 100644 --- a/packages/create-vite/template-react-ts/src/main.tsx +++ b/packages/create-vite/template-react-ts/src/main.tsx @@ -1,11 +1,10 @@ import React from 'react' -import ReactDOM from 'react-dom' -import './index.css' +import ReactDOM from 'react-dom/client' import App from './App' +import './index.css' -ReactDOM.render( +ReactDOM.createRoot(document.getElementById('root')!).render( - , - document.getElementById('root') + ) diff --git a/packages/create-vite/template-react/package.json b/packages/create-vite/template-react/package.json index f6a93540f0d3ee..ac105bd8796ace 100644 --- a/packages/create-vite/template-react/package.json +++ b/packages/create-vite/template-react/package.json @@ -8,11 +8,13 @@ "preview": "vite preview" }, "dependencies": { - "react": "^17.0.2", - "react-dom": "^17.0.2" + "react": "^18.0.0", + "react-dom": "^18.0.0" }, "devDependencies": { - "@vitejs/plugin-react": "^1.0.7", - "vite": "^2.9.0" + "@types/react": "^17.0.43", + "@types/react-dom": "^17.0.14", + "@vitejs/plugin-react": "^1.3.0", + "vite": "^2.9.1" } } diff --git a/packages/create-vite/template-react/src/main.jsx b/packages/create-vite/template-react/src/main.jsx index 606a3cf44ec02b..9af0bb638e42c0 100644 --- a/packages/create-vite/template-react/src/main.jsx +++ b/packages/create-vite/template-react/src/main.jsx @@ -1,11 +1,10 @@ import React from 'react' -import ReactDOM from 'react-dom' -import './index.css' +import ReactDOM from 'react-dom/client' import App from './App' +import './index.css' -ReactDOM.render( +ReactDOM.createRoot(document.getElementById('root')).render( - , - document.getElementById('root') + )