Fork me on GitHub
#helix
<
2021-05-23
>
Emi Gal17:05:09

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"))))

Jimmy Miller18:05:49

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.

Jimmy Miller18:05:41

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 🙂

Emi Gal20:05:42

Thanks - will look into that guide (even though it does look incomplete).

Emi Gal21:05:52

oh, awesome - will try that. Thanks!