I’m struggling to make re-frame work with Helix. The subscription works, but the dispatch and / or reloading the component when the event is triggered doesn’t seem to be working. Here’s the code, can anyone figure out what I’m doing wrong?
(defnc TabA [_] {:helix/features {:fast-refresh true}}
($ rn/View {:style (j/lit {:flex 1, :alignItems "center", :justifyContent "center"})}
($ rn/Text {:style (j/lit {:fontSize 36})}
(str "clicked " @(rf/subscribe [:get-counter])))
($ rn/TouchableOpacity {:style (:button styles)
:on-press #(rf/dispatch [:inc-counter])}
($ rn/Text {:style (j/lit {:fontSize 36})} "Click here"))))
As far as I know, reframe is very specifically tied to reagent and you will have a really hard time using it with anything else.
Actually, there is a guide on this though. https://cljdoc.org/d/lilactown/helix/0.0.13/doc/integrating-with-other-libraries
Looks like not fully fleshed out. But gives an idea on what will be required. Some sort of custom hook to subscribe to the r/atom. If you are not super experienced with this stuff, I'd personally recommend against the combination unless this is just a for fun project 🙂
Thanks - will look into that guide (even though it does look incomplete).
here is a example of a hook to solve the problem: https://github.com/lilactown/hooks-demo/blob/master/src/hooks_demo/hooks.cljs#L41
oh, awesome - will try that. Thanks!