Skip to content

Comments

Add React 19 support#49

Merged
betula merged 1 commit intobetula:masterfrom
shsr04:master
Nov 25, 2025
Merged

Add React 19 support#49
betula merged 1 commit intobetula:masterfrom
shsr04:master

Conversation

@shsr04
Copy link
Contributor

@shsr04 shsr04 commented Nov 21, 2025

This merge request introduces React v19 support for use-between.

The problem:

  • In React 19, the hook dispatcher was moved into __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE (or on server: __SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE)
  • The field name was changed to H
  • H is no longer a static value, but it is initially null and is reassigned based on certain conditions (see renderWithHooks)

I solved this by:

  • first checking the old __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED to remain compatible with React 18
  • otherwise, returning a small { current } wrapper which forwards directly to the ReactSharedInternals.H property
    • no caching, current always points to the current dispatcher used by React, as expected by use-between

@shsr04 shsr04 mentioned this pull request Nov 21, 2025
@betula
Copy link
Owner

betula commented Nov 21, 2025

Awesome!
Thanks a lot!
I'll merge it on the weekend!

@betula betula merged commit ca2d925 into betula:master Nov 25, 2025
0 of 2 checks passed
@shsr04
Copy link
Contributor Author

shsr04 commented Nov 27, 2025

Cool, thanks! Regarding the pipeline errors, this can be resolved by pinning the cheerio to version 1.0.0-rc.12. https://stackoverflow.com/questions/78867305/jest-unit-tests-are-failing

Or it may be worth updating the dependencies with a reproducible lockfile.

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.

2 participants