Skip to content

Commit 64c7c49

Browse files
authored
deps: update peerDeps to support React 18 without warnings (#89)
- seems to work without any component modifications needed on React 18 - React 18 was mostly _deprecations_ and new features per the upgrade guide: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html - React 18 has concurrent mode opt-in, which is technically breaking, but doesn't seem to effect this library (fortunately) - ensure tests pass with React 18 - update devDeps to React 18, react-dom 18, @types/react 18 - update devDeps to RTL 13 which supports React 18 - see previous commit for the migration from Enzyme to RTL since Enzyme never had official support for React 17, let alone React 18 - update example to use `createRoot` instead of `ReactDOM.render` - this is one of the opt-ins to React 18 mode, and doesn't seem to change anything about the example (just no warnings anymore)
1 parent 8e431f5 commit 64c7c49

File tree

3 files changed

+75
-83
lines changed

3 files changed

+75
-83
lines changed

example/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from 'react'
2-
import ReactDOM from 'react-dom'
2+
import { createRoot } from 'react-dom/client'
33

44
import SignaturePad from '../../src/index.tsx'
55

@@ -43,4 +43,4 @@ class App extends Component {
4343
}
4444
}
4545

46-
ReactDOM.render(<App />, document.getElementById('container'))
46+
createRoot(document.getElementById('container')).render(<App />)

package-lock.json

Lines changed: 67 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@
6565
},
6666
"peerDependencies": {
6767
"prop-types": "^15.5.8",
68-
"react": "0.14 - 17",
69-
"react-dom": "0.14 - 17"
68+
"react": "0.14 - 18",
69+
"react-dom": "0.14 - 18"
7070
},
7171
"dependencies": {
7272
"@babel/runtime": "^7.17.9",
7373
"@types/prop-types": "^15.7.3",
74-
"@types/react": "^17.0.44",
74+
"@types/react": "^18.0.12",
7575
"@types/signature_pad": "^2.3.0",
7676
"signature_pad": "^2.3.2",
7777
"trim-canvas": "^0.1.0"
@@ -89,15 +89,15 @@
8989
"@rollup/plugin-babel": "^5.3.1",
9090
"@rollup/plugin-commonjs": "^21.1.0",
9191
"@rollup/plugin-node-resolve": "^13.2.1",
92-
"@testing-library/react": "^12.1.5",
92+
"@testing-library/react": "^13.3.0",
9393
"canvas": "^2.9.1",
9494
"concurrently": "^7.1.0",
9595
"jest": "^27.5.1",
9696
"jest-config": "^27.5.1",
9797
"package-json-type": "^1.0.3",
9898
"parcel": "^2.4.1",
99-
"react": "^17.0.2",
100-
"react-dom": "^17.0.2",
99+
"react": "^18.2.0",
100+
"react-dom": "^18.2.0",
101101
"rollup": "^2.70.2",
102102
"rollup-plugin-node-externals": "^4.0.0",
103103
"rollup-plugin-terser": "^7.0.2",

0 commit comments

Comments
 (0)