This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-22
Channels
- # announcements (4)
- # aws (1)
- # beginners (82)
- # boot (14)
- # braveandtrue (1)
- # calva (73)
- # cider (7)
- # cljs-dev (7)
- # cljsrn (1)
- # clojure (83)
- # clojure-belgium (1)
- # clojure-dev (3)
- # clojure-europe (4)
- # clojure-france (3)
- # clojure-italy (31)
- # clojure-nl (11)
- # clojure-uk (15)
- # clojurescript (19)
- # code-reviews (9)
- # cursive (16)
- # data-science (1)
- # datomic (16)
- # events (1)
- # fulcro (4)
- # graalvm (1)
- # hoplon (7)
- # jackdaw (5)
- # java (10)
- # jobs (6)
- # jobs-discuss (7)
- # juxt (1)
- # leiningen (6)
- # midje (1)
- # off-topic (2)
- # pathom (18)
- # pedestal (1)
- # reagent (8)
- # reitit (2)
- # ring (1)
- # shadow-cljs (38)
- # spacemacs (5)
- # sql (41)
- # vim (10)
- # xtdb (1)
I am getting a warning: The same with-let is being used more than once in the same reactive context.
I want to use some component multiple times. Is this not possible with a reagent/with-let
?
(re-frame/reg-event-db
::test-add
(fn [_ [_ cnt]]
(swap! cnt inc)))
(defn test2 [id]
(reagent/with-let [cnt (reagent/atom 1)]
[:div {:id id}
(for [i (range @cnt)]
(str "Hello for the " (str i) "th time."))
[:button
{:on-click #(re-frame/dispatch [::test-add cnt])}
"Click me!"]]))
(defn main-form [] ;; works
(test2 (str "test1")))
(defn main-form [] ;; doesn't works
(for [i (range 3)]
(test2 (str "test" (str i)))))
@finn.volkel try wrapping your test2 component in a vector like [test2 (str “test” i)]
rather than call it as a function