Skip to content

Commit

Permalink
feat: support react 18 (#2515)
Browse files Browse the repository at this point in the history
* 升级react 18

* 忽略.history

* 忽略.history

* build the project with react18

* change package.json version to 3.0.0

* 不修改code style, 不手动改版本号

* 不修改code style, 回滚代码样式格式化

* chore: code style

* chore: code style

---------

Co-authored-by: yougen <yougen.zhuangyg@alibaba-inc.com>
Co-authored-by: sorrycc <sorrycc@gmail.com>
  • Loading branch information
3 people authored May 10, 2024
1 parent 968da6a commit b02daba
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
/packages/**/node_modules
/packages/**/dist
/lerna-debug.log

4 changes: 2 additions & 2 deletions docs/guide/source-code-explore.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ function getProvider(store, app, router) {

// 真正的 react 在这里
function render(container, store, app, router) {
const ReactDOM = require('react-dom'); // eslint-disable-line
ReactDOM.render(React.createElement(getProvider(store, app, router)), container);
const ReactDOM = require('react-dom/client') // eslint-disable-line
ReactDOM.createRoot(container).render(React.createElement(getProvider(store, app, router)));
}
```

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"lerna-changelog": "^0.8.0",
"lint-staged": "^7.2.2",
"prettier": "^1.14.3",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-testing-library": "^6.0.0",
"shelljs": "^0.8.1",
"umi-test": "^1.5.2"
Expand Down
4 changes: 2 additions & 2 deletions packages/dva/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"redux": "^4.0.1"
},
"peerDependencies": {
"react": "^16.8.4",
"react-dom": "^16.8.4"
"react": ">=18",
"react-dom": ">=18"
},
"files": [
"dist",
Expand Down
4 changes: 2 additions & 2 deletions packages/dva/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ function getProvider(store, app, router) {
}

function render(container, store, app, router) {
const ReactDOM = require('react-dom'); // eslint-disable-line
ReactDOM.render(React.createElement(getProvider(store, app, router)), container);
const ReactDOM = require('react-dom/client'); // eslint-disable-line
ReactDOM.createRoot(container).render(React.createElement(getProvider(store, app, router)));
}

function patchHistory(history) {
Expand Down

0 comments on commit b02daba

Please sign in to comment.