Can someone give me a pointer on how to use re-frame (not refx) with helix? I like refx but I need things that later versions of re-frame offer and I don’t have time to fix refx. There was a thread by @danvingo about using a react hook but I don’t get it yet.
I just tried this code @danvingo mentioned and it seems to work fine, thanks for sharing! Don’t really like that I still need the Reagent dependency, but of course that is inevitable. Hopefully, re-frame some day decides to become independent, because it still works so incredibly well for me.
Btw, in case someone else runs into this issue: when using use-callback from helix.hooks, remember that the dependency vector needs to be the first form. In UIx it is the other way around, so the forms have to be swapped.
For the reagent dependency - if you inspect the build report it should only ~8kb - the reagent.ratom namespace. The UI/component code shouldn't be used if you're just using re-frame.
Oh, that’s good to know!
use-sync-external-store is only needed for React 17 and earlier. Also scheduler is a transitive dependency of react
Have you seen https://github.com/pitch-io/uix/blob/master/docs/interop-with-reagent.md#syncing-with-ratoms-and-re-frame ? Copying that to your project should allow using re-frame from helix
you'll have to npm install a few packages: https://www.npmjs.com/package/scheduler - this may already be included with react https://www.npmjs.com/package/use-sync-external-store
I just wouldn't
Basically I have a hook, but I am getting WARN re-frame: Subscribe was called outside of a reactive context.