This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-23
Channels
- # announcements (19)
- # babashka (6)
- # beginners (47)
- # cljs-dev (4)
- # cljsrn (3)
- # clojure (18)
- # clojure-australia (3)
- # clojurescript (50)
- # code-reviews (1)
- # conjure (16)
- # datomic (6)
- # editors (4)
- # emacs (1)
- # fulcro (10)
- # graphql (3)
- # helix (7)
- # jackdaw (10)
- # malli (1)
- # off-topic (3)
- # pathom (4)
- # sci (2)
- # shadow-cljs (39)
- # testing (3)
- # tools-deps (5)
- # vscode (1)
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 🙂
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