stripe/react-stripe-js

[Feature Request] React 19 support

Opened this issue ยท 9 comments

What happened?

After updating NextJS to latest 15.x this package stopped working, because of its peer-dependencies. (see log below)
Please add React 19 as a possible peer-dependency.

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: ResDiary-PaymentLandingPage@0.1.0
npm error Found: react@19.0.0-rc-65a56d0e-20241020
npm error node_modules/react
npm error   react@"19.0.0-rc-65a56d0e-20241020" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"^16.8.0 || ^17.0.0 || ^18.0.0" from @stripe/react-stripe-js@2.8.1
npm error node_modules/@stripe/react-stripe-js
npm error   @stripe/react-stripe-js@"*" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.

Environment

No response

Reproduction

No response

React 19 is still RC and not a stable release, so for now it's not supported/tested. Once that's release I expect we'll work towards updating that to allow 19.

If you're already running pre-release version, you can try disabling those peer deps to test.

Next.js 15 is now stable and ready for production using react 19 (as of late October) .
https://nextjs.org/blog/next-15

Is the plan still to wait for an official react 19 release? This is currently the only package we use that is not react 19 ready.

Yes, we'll validate once released. Until then please feel free to report any issue you encounter with the RC. We don't expect any breaking changes, since we don't knowingly use any of the features with changes, but this is no guarantee until everything is settled and we're able to test.

Reshaping this as a feature request, since that's the ask here. Currently, nothing is not working as expected.

I've opened a PR w/ the peer dependency bump:

#551

In the meantime, it is possible to override (but probably unwise until it has been fully vetted) via the following in package.json then running npm install:

  "overrides": {
    "@stripe/react-stripe-js": {
      "react": "^19.0.0",
      "react-dom": "^19.0.0"
    }
  }

I noticed to properly bump this library a few things need to happen:

  1. The core versions of react / react-dom probably should swap to 19 (or matrix testing).
  2. @testing-library/react needs to be bumped then (which needs some test cleanup).

Thanks all -- now that React 19 is stable, we've exercised our integration tests to verify and should be bumping this peer dependency soon: #552

We're not aware of any incompatibilities (other than SSR/RSC which we do not currently support), since our component are generally thin wrappers around Stripe.js that aren't doing anything elaborate. However, we absolutely want to hear about any issues if you discover them in your integrations.

are we waiting for a new version to be available on npm?

Following

3.1.0 was published today and includes the updated peer dependency: https://github.com/stripe/react-stripe-js/releases/tag/v3.1.0