Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to React 18 (#2087) #2110

Merged
merged 1 commit into from Feb 10, 2023
Merged

Upgrade to React 18 (#2087) #2110

merged 1 commit into from Feb 10, 2023

Conversation

ThomasRoest
Copy link
Collaborator

Feat: Support React 18

  • chore: upgrade react dependencies

  • chore: replace ReactDOM.render with createRoot in index.ts

  • chore: fix new TS errors after upgrading @types

  • chore: replace ReactDOM.render in Preview.tsx

  • chore: replace ReactDOM.unmountComponentAtNode with root.unmount()

  • chore: remove ReactDOM import

  • chore: upgrade react testing library

  • chore: replace deprecated React.SFC type with React.FC

DefinitelyTyped/DefinitelyTyped#30364

  • chore: Fix TS errors in propTypes.children

propTypes.node results in TS errors. There doesn't seem to be a good alternative ( other than making the children propTypes more strict, which could result more errors) Instead use something less restrictive (propTypes.any) for children and components.

  • chore: fix TS errors, extract props interfaces with children

  • chore: fix TS errors, add context types

  • chore: TS fix

  • fix: Fix React unmount error

Unmount asynchronously with setTimout
https://stackoverflow.com/questions/73459382/react-18-async-way-to-unmount-root

error message:
Warning: Attempted to synchronously unmount a root while React was already rendering. React cannot finish unmounting the root until the current render has completed, which may lead to a race condition.

  • test: make wrapper unmount test async

Co-authored-by: Thomas Roest thomas.roest@moxio.com

* chore: upgrade react dependencies

* chore: replace ReactDOM.render with createRoot in index.ts

* chore: fix new TS errors after upgrading @types

* chore: replace ReactDOM.render in Preview.tsx

* chore: replace ReactDOM.unmountComponentAtNode with root.unmount()

* chore: remove ReactDOM import

* chore: upgrade react testing library

* chore: replace deprecated React.SFC type with React.FC

DefinitelyTyped/DefinitelyTyped#30364

* chore: Fix TS errors in propTypes.children

propTypes.node results in TS errors. There doesn't seem to be a good alternative ( other than making the children propTypes more strict, which could result more errors)
Instead use something less restrictive (propTypes.any) for children and components.

* chore: fix TS errors, extract props interfaces with children

* chore: fix TS errors, add context types

* chore: TS fix

* fix: Fix React unmount error

Unmount asynchronously with setTimout
https://stackoverflow.com/questions/73459382/react-18-async-way-to-unmount-root

error message:
Warning: Attempted to synchronously unmount a root while React was already rendering. React cannot finish unmounting the root until the current render has completed, which may lead to a race condition.

* test: make wrapper unmount test async

---------

Co-authored-by: Thomas Roest <thomas.roest@moxio.com>
@ThomasRoest ThomasRoest merged commit 310b08a into master Feb 10, 2023
@ThomasRoest ThomasRoest deleted the React-18 branch February 10, 2023 15:02
@github-actions
Copy link

🎉 This PR is included in version 13.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant