This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-06
Channels
- # announcements (16)
- # aws (9)
- # babashka (76)
- # beginners (92)
- # boot (1)
- # cider (18)
- # clara (7)
- # clj-kondo (26)
- # clojure (104)
- # clojure-europe (4)
- # clojure-nl (11)
- # clojure-spec (11)
- # clojure-survey (101)
- # clojure-uk (35)
- # clojuredesign-podcast (18)
- # clojurescript (8)
- # core-async (29)
- # data-science (1)
- # datomic (13)
- # emacs (4)
- # fulcro (20)
- # graalvm (14)
- # instaparse (2)
- # jobs (1)
- # juxt (6)
- # malli (5)
- # off-topic (30)
- # onyx (3)
- # planck (1)
- # project-updates (7)
- # re-frame (38)
- # reagent (30)
- # reitit (14)
- # remote-jobs (2)
- # shadow-cljs (50)
- # sql (8)
<Button
variant="contained"
color="secondary"
className={classes.button}
startIcon={<DeleteIcon />}
>
(defn rec-toggle [{record? :record?}]
[:> Button
{:aria-label "Rec"
:on-click (fn [] (rf/dispatch [:proxy/record! {:id @(rf/subscribe [:session/page])
:record? (not record?)}]))
:startIcon (r/as-element [:> RadioButtonChecked] )
; :startIcon (if record? (r/as-element [:> RadioButtonChecked] ) (r/as-element [:> RadioButtonUnchecked]) )
}
"Record"
]
)
but it does not work if i inspect with React tools I see an element prop gets there <Memo/> but nothing gets rendered
Also, don't use subscribe
in re-frame or JS event handlers. It creates a memory leak and AFAICT gradually degrades the performance.
You should deref
(or @
) the sub in the view itself. The subscription has to be dereferenced when the view is rendered.
the view being the actual function meaning
(defn my-component []
(let [someDeRef @(subscribe...]
....someHickup)
Yep, something like that. And then just use someDeRef
in that dispatch
.
No problem. :)
@jstuartmilne (r/as-element ...)
is the right way. Make sure you’ve imported RadioButtonChecked
properly and that you’re using Material-UI >= 4.5.0