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 6d6dcd1 commit daa5ca2
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 75 deletions.
4 changes: 2 additions & 2 deletions example/app.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.js'

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

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

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

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@
},
"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": {
"signature_pad": "^2.3.2",
"trim-canvas": "^0.1.0"
},
"devDependencies": {
"@agilgur5/changelog-maker": "^3.0.0",
"@testing-library/react": "^12.1.5",
"@testing-library/react": "^13.3.0",
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.2",
"babel-jest": "^23.6.0",
Expand All @@ -72,8 +72,8 @@
"jest": "^24.8.0",
"jest-environment-jsdom-fifteen": "^1.0.2",
"jest-without-globals": "^0.0.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hot-loader": "^4.13.0",
"standard": "^13.0.2",
"style-loader": "^0.13.1",
Expand Down

0 comments on commit daa5ca2

Please sign in to comment.