facebookexperimental / Recoil

Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.
https://recoiljs.org/
MIT License
19.5k stars 1.18k forks source link

React 19 support #2318

Open RobinClowers opened 1 month ago

RobinClowers commented 1 month ago

It appears recoil does not work with the react 19 RC that came out today. I'm guessing this will not be resolved, since Meta has abandoned this project, but I'd love to be wrong!

TypeError: react__WEBPACK_IMPORTED_MODULE_0___default().__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED is undefined
    currentRendererSupportsUseSyncExternalStore index.js:511
    useRecoilValueLoadable index.js:5353
    useRecoilValue index.js:5372
wojtekmaj commented 1 month ago

It looks like replacing currentRendererSupportsUseSyncExternalStore body with return true does the trick. I mean, at this point it's probably better to migrate away from Recoil, but if you really, REALLY have to, then that could be a way to work around it.

RobinClowers commented 1 month ago

@wojtekmaj thanks for chiming in! Definitely planning a migration, but nice to know there is an option if we want to defer it a bit.

CarlosVergikosk commented 1 month ago

It looks like replacing currentRendererSupportsUseSyncExternalStore body with return true does the trick. I mean, at this point it's probably better to migrate away from Recoil, but if you really, REALLY have to, then that could be a way to work around it.

Why would you say that at this point migration would be better? Thanks

wojtekmaj commented 1 month ago

Why would you say that at this point migration would be better? Thanks

@CarlosVergikosk It's heartbreaking to say but I don't see Facebook is interested in keeping this project alive anymore. The latest version is broken in React Native (#2274), and has been for more than a year now.

At the same time, Recoil is no longer the only choice for using Suspense for Data Fetching and other, community-provided projects have not only caught to speed with Recoil, but surpassed it in terms of functionality, stability, maintainability, and community activity, the latter of which is a great factor for approximating project health.

Recoil was an amazing solution when it came out, but I'd advise anyone not to use it in new projects and consider migrating away from it in existing ones.

CarlosVergikosk commented 1 month ago

Unfortunately i belive you are right @wojtekmaj, in terms of options to recoil, what would you suggest based on your experience?

Thanks for taking the time to contribute.

wojtekmaj commented 1 month ago

Depends on your use case. Here's my first thought:

XQY279 commented 2 weeks ago

It looks like replacing currentRendererSupportsUseSyncExternalStore body with return true does the trick. I mean, at this point it's probably better to migrate away from Recoil, but if you really, REALLY have to, then that could be a way to work around it.

The modification was successful, but a new error has occurred: Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform

The source code generated by Recoil still contains many instances of React.createElement.

haula-dv commented 5 days ago

It appears recoil does not work with the react 19 RC that came out today. I'm guessing this will not be resolved, since Meta has abandoned this project, but I'd love to be wrong!

TypeError: react__WEBPACK_IMPORTED_MODULE_0___default().__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED is undefined
    currentRendererSupportsUseSyncExternalStore index.js:511
    useRecoilValueLoadable index.js:5353
    useRecoilValue index.js:5372

I have a library can using like recoil https://www.npmjs.com/package/nes-zustand