Skip to content

[react] Add React 19 support to reduce migration burden #4857

@maxpatiiuk

Description

@maxpatiiuk

Should this be an RFC?

  • This is not a substantial change

Which package is this a feature request for?

React (@lit/react)

Description

@lit/react appears to work in React 19 in my limited testing. The only issue is that this line in package.json needs to be updated to add || 19

"@types/react": "17 || 18"

I understand that React 19 supports custom elements, removing the need for wrappers. However, to smooth the ecosystem migration, it might be a good idea to support wrappers in React 19 too.

Use cases:

  • Forcing people to refactor out all wrappers usages and drop @lit/react before adopting React 19 is going to make the migration burden harder. Better let people gradually adopt React 19 and drop wrappers afterward.
  • In a monorepo, some packages might update to React 19 before others
    • Example: updating storybook may require updating to React 19, while the code is not ready to
  • Using wrappers may have better DX because IDEs can auto-import them on usages, and detect needless imports (assuming the package that uses @lit/react has separate entrypoint for each component wrapper, with a side effect import of the component inside) - not so for side-effect component imports.

Alternatives and Workarounds

Use yarn/npm "resolutions" to force @llit/react to work with @types/react@19.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    📋 Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions