Skip to content

Commit

Permalink
deps: update peerDeps to support React 18 without warnings (#89)
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
agilgur5 committed Jun 16, 2022
1 parent 8e431f5 commit 64c7c49
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 83 deletions.
4 changes: 2 additions & 2 deletions example/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import { createRoot } from 'react-dom/client'

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

Expand Down Expand Up @@ -43,4 +43,4 @@ class App extends Component {
}
}

ReactDOM.render(<App />, document.getElementById('container'))
createRoot(document.getElementById('container')).render(<App />)
142 changes: 67 additions & 75 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@
},
"peerDependencies": {
"prop-types": "^15.5.8",
"react": "0.14 - 17",
"react-dom": "0.14 - 17"
"react": "0.14 - 18",
"react-dom": "0.14 - 18"
},
"dependencies": {
"@babel/runtime": "^7.17.9",
"@types/prop-types": "^15.7.3",
"@types/react": "^17.0.44",
"@types/react": "^18.0.12",
"@types/signature_pad": "^2.3.0",
"signature_pad": "^2.3.2",
"trim-canvas": "^0.1.0"
Expand All @@ -89,15 +89,15 @@
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^21.1.0",
"@rollup/plugin-node-resolve": "^13.2.1",
"@testing-library/react": "^12.1.5",
"@testing-library/react": "^13.3.0",
"canvas": "^2.9.1",
"concurrently": "^7.1.0",
"jest": "^27.5.1",
"jest-config": "^27.5.1",
"package-json-type": "^1.0.3",
"parcel": "^2.4.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "^2.70.2",
"rollup-plugin-node-externals": "^4.0.0",
"rollup-plugin-terser": "^7.0.2",
Expand Down

0 comments on commit 64c7c49

Please sign in to comment.