This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-08
Channels
- # announcements (22)
- # aws (4)
- # babashka (25)
- # beginners (78)
- # calva (9)
- # cider (22)
- # cljdoc (2)
- # cljsrn (2)
- # clojure (27)
- # clojure-australia (7)
- # clojure-europe (22)
- # clojure-nl (15)
- # clojure-uk (26)
- # clojurescript (20)
- # datahike (3)
- # datomic (15)
- # events (1)
- # helix (5)
- # honeysql (4)
- # kaocha (1)
- # malli (1)
- # meander (1)
- # off-topic (84)
- # pathom (14)
- # re-frame (3)
- # reagent (28)
- # reitit (6)
- # sci (1)
- # shadow-cljs (78)
- # tools-deps (30)
Dealing w/re-frame and going through the documentation a couple of questions left swirling in my head.
The problem is the following - receive input
, validate
and alter
the input box according the validation
result (style). (I’m using js lib for that, but I guess unnecessary detail).
Question: I chained validation to mobile-number-input
event but I’m not sure if it’s the right way - how and where should I introduce validate-phone-num
function?
(defn validate-phone-num
[phone-num]
...)
(reg-event-db
:set-mobile-num-valid-status
...)
(reg-event-fx
:event-name
(fn [{:keys [db]} [_ mobile-num]]
(let [valid? (validate-phone-num mobile-num)
status (if valid? :success :warning]
{:db (assoc mobile number
:fx [[:dispatch [:set-mobile-num-status status]]})
In general I would check simple formatting stuff in the view before triggering an event but I don't know what your doing in that fn
Thanks for response Ray! Well, I eventually implemented this functionality in/using subscriptions/->calculations. I don’t think it did worth bloating the global state w/additional keys.
måning¡
Good morning
Parenthood has all sorts of challenges. My boy won't sleep in a pram yet, so when we're out for long, like today, he sleeps on one of us. And my problem right now has been to find an area with shade so that we don't get roasted. It's all flat and no trees in this area, and houses being built, so I'm borrowing the shade of an unbuilt house.
I wrapped him as tight as I could!
mornin