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

fix: Add support for React 18 #265

Merged
merged 3 commits into from Dec 8, 2022
Merged

fix: Add support for React 18 #265

merged 3 commits into from Dec 8, 2022

Conversation

michaeltaranto
Copy link
Contributor

@michaeltaranto michaeltaranto commented Dec 8, 2022

Upgrade to support using React 18, while also maintaining backwards compatibility and handling React 17.

Key Changes

React Render API

The approach was heavily inspired by the approach used by Storybook, while avoiding the need to add config to control the version. Playroom decides which version of the render API to use based on the version of react-dom it resolves.

Code editor

The react-codemirror2 editor is unmaintained and not compatible with React 18 (using legacy APIs and not throwing the peer dependency warning). As it is just a thin react wrapper with no additional dependencies, and given the legacy lifecycle hooks still work, we opted to embed a copy while we investigate a Codemirror 6 migration separately.

As part of bringing it in there were some minor modifications:

  • Remove unused Controlled version of the editor
  • Improved type annotations

Extras

Use @ts-expect-error declaration instead of @ts-ignore and fix handful of issues where types were available.


Closes #261

@michaeltaranto michaeltaranto requested a review from a team as a code owner December 8, 2022 22:30
@michaeltaranto michaeltaranto mentioned this pull request Dec 8, 2022
Copy link
Contributor

@askoufis askoufis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@michaeltaranto michaeltaranto merged commit b846abb into master Dec 8, 2022
@michaeltaranto michaeltaranto deleted the react18 branch December 8, 2022 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

React 18 support
2 participants