-
Notifications
You must be signed in to change notification settings - Fork 414
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
RFC: Provide a React hook for using ratoms/reactions as part of public API #545
Comments
Yes, I'd be interested in including this. I wonder if there would be some use for the other direction also? Creating a ratom backed by a hook? |
Thanks. It looks like there's some new development happening in React 18 which I think I would wait for before creating a hook for public consumption: reactwg/react-18#86 The above discussion lays out a plan for React to provide an API to make synchronizing external state (i.e. ratoms) easy to do in concurrent mode.
I can't imagine a case right now, and since React component state has different scheduling behavior than ratoms (i.e. they update async, not sync) I would also imagine it would be confusing for users. |
I'm in the process of using the My code so far is below, and IIUC, your Am I understanding what's you've made correctly? If so, where can I find the code so that I can use it for my case?
|
@kovasap the problem with your code seems unrelated to this issue. I'd suggest opening a separate one, or asking in the #reagent channel in clojurians.net slack team for help. |
useSyncExternalStore is now available with React 18. |
I've been working on a project for some time that integrates our existing reagent/re-frame application with some plain react components developed using helix. In order to do this, I had to do a lot of work to write an integration between reagent's ratoms/reactions and React hooks. I essentially have a custom hook called
use-reaction
that looks like:Currently this relies on a lot of internal Reagent machinery in order to properly set up watching and disposing the reaction. I think it would be appropriate to add such an integration point to Reagent proper, so that it can change along with any internal changes.
Would the maintainers be interested in accepting a PR for this?
The text was updated successfully, but these errors were encountered: