This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-22
Channels
- # arachne (8)
- # bangalore-clj (1)
- # beginners (72)
- # boot (95)
- # braveandtrue (5)
- # business (1)
- # capetown (1)
- # cider (180)
- # cljs-dev (8)
- # cljsrn (20)
- # clojure (104)
- # clojure-art (1)
- # clojure-brasil (8)
- # clojure-czech (1)
- # clojure-greece (15)
- # clojure-korea (13)
- # clojure-poland (2)
- # clojure-russia (53)
- # clojure-sg (5)
- # clojure-spec (60)
- # clojure-uk (35)
- # clojurescript (186)
- # community-development (3)
- # core-async (24)
- # cursive (18)
- # datascript (11)
- # datomic (39)
- # devcards (4)
- # emacs (2)
- # events (1)
- # funcool (23)
- # hoplon (148)
- # juxt (1)
- # ldnclj (2)
- # luminus (1)
- # off-topic (22)
- # om (27)
- # onyx (35)
- # overtone (2)
- # pedestal (7)
- # perun (8)
- # protorepl (2)
- # rdf (6)
- # re-frame (15)
- # reagent (2)
- # ring-swagger (10)
- # untangled (54)
1. I'm using reframe + reagent. 2. My code is (def main-panel [:div "hello world" [:pre "abc"] (fn [] [:pre "def"])]) 3. What happens is: "hello world" and "abc" renders "def" does not render 4. My question: why does "def" not render? I thought (fn [] ... ) were supposed to be auto-called -- as they are the parts that get recomputed when a reactive-atom changes.
@hwk My guess would be because it's not the first element in a vector. Try just wrapping it in []
@hwk what @geoffs says is right. To understand why, you should read through the reagent tutorials at the bottom of this page: https://github.com/Day8/re-frame/wiki
@geoffs: that worked, thanks! @mikethompson : will work through that -- earlier I worked through https://reagent-project.github.io/ -- and am now surprised this is documented under "re-frame" unstead of "reagent"
https://github.com/Day8/re-frame/wiki/Creating%20Reagent%20Components <-- docs here is excellent. When I had to get canvas to work inside reagent -- this was the only page on the net that explaiend "form 3" and how to get canvas working.
[:ul ~@(for [k lst] [:li (str k)])] <-- is it okay to do something like this, or will
~@ do something that bites me later ?
I'd suggest (into [:ul] (for [k lst] [:li (str k)]))
@mikethompson : clever use of (into) -- thanks!
@danielcompton @sam.roberton Great! I’ll mess around with it and when you’re starting documentation I might be able to chip in.
How to solve this problem: We have a local ratom for performance that takes the initial value of a subscription and we update it in our component. But whenever the subscription changes, the local ratom should also be updated.
@borkdude no clean way to do that that I'm aware of
In the absence of "clean", it comes down to "simple". Perhaps:
(reaction (reset! local-ratom @sub) )
So
(defn view
[]
(let [sub (subscribe [:some :thing])
rat (reagent/atom 12)
_ (reaction (reset! rat @sub))]
(fn view-render
[]
[:div ....])))
When the value delivered by sub
changes, rat
will be reset!
to that new value.