This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-08
Channels
- # announcements (1)
- # babashka (18)
- # beginners (32)
- # calva (3)
- # chlorine-clover (4)
- # cider (14)
- # clj-commons (24)
- # clj-kondo (1)
- # clojure (34)
- # clojure-europe (4)
- # clojure-filipino (1)
- # clojure-uk (4)
- # clojuredesign-podcast (2)
- # clojurescript (6)
- # conjure (3)
- # core-async (2)
- # datahike (1)
- # datomic (3)
- # emacs (3)
- # esprit (20)
- # fulcro (4)
- # graalvm (11)
- # helix (13)
- # honeysql (4)
- # jobs (1)
- # lumo (1)
- # observability (4)
- # off-topic (11)
- # other-lisps (6)
- # pathom (6)
- # re-frame (13)
- # reagent (1)
- # reitit (1)
- # shadow-cljs (26)
- # web-security (2)
- # xtdb (10)
I have the following reagent component. if i remove the random-uuid i get warnings and if i add them, the input field loses focus after entering a single character! what is going on here? can somebody please help me?
(defn input-fields
[]
[:div
[:div.h1
[:p (str "content of states: " @state)]
[:p "fuck you"]]
(doall
(for [id (range 5)]
[:div #_{:key (random-uuid)}
[:input {
:type :text
:value #_(:foo @state)
(sp/select-one [sp/ATOM :input sp/ALL #(= (:id %) id) :attribute] state)
:on-change (fn [e]
(sp/transform [sp/ATOM :input sp/ALL #(= (:id %) id)]
(fn[x] (assoc x :attribute (-> e .-target .-value))) state))}]
[:input {
:type :text
:value #_(:foo @state)
(sp/select-one [sp/ATOM :input sp/ALL #(= (:id %) id) :value] state)
:on-change (fn [e]
(sp/transform [sp/ATOM :input sp/ALL #(= (:id %) id)]
(fn[x] (assoc x :value (-> e .-target .-value))) state))}]]))
[:input {
:type :button
:value :submit
:on-click (fn [e]
(println "submit placeholder"))}]])