This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-05
Channels
- # beginners (229)
- # cider (54)
- # cljs-dev (187)
- # cljsrn (1)
- # clojure (187)
- # clojure-dev (5)
- # clojure-italy (31)
- # clojure-losangeles (1)
- # clojure-russia (3)
- # clojure-spec (76)
- # clojure-uk (29)
- # clojurescript (94)
- # cursive (18)
- # datascript (8)
- # datomic (26)
- # docker (6)
- # emacs (19)
- # figwheel (6)
- # fulcro (41)
- # garden (1)
- # graphql (1)
- # hoplon (33)
- # jobs (1)
- # jobs-discuss (1)
- # lein-figwheel (14)
- # leiningen (7)
- # nrepl (10)
- # nyc (1)
- # off-topic (2)
- # onyx (2)
- # parinfer (25)
- # portkey (6)
- # powderkeg (1)
- # protorepl (1)
- # re-frame (14)
- # reagent (14)
- # shadow-cljs (31)
- # spacemacs (3)
- # test-check (33)
- # uncomplicate (1)
- # unrepl (40)
- # vim (5)
- # yada (16)
@gadfly361 https://github.com/CalebMacdonaldBlack/re-frame-interceptors-demo/blob/functions/src/cljs/demo/events.cljs Heres what I ended up with. To summarise my problem, I’m trying to define the pathways/decision tree for my business logic in my event handler. I do not want to bounce around functions (or events) trying to map in my head what the logic is doing.
This allows me to define the condition and the path for a branch. I can also chain events together (For example http-xhrio).
I will likely add more ways to branch (cond, case, when ect) as I need them if this works out.
@caleb.macdonaldblack thanks! Looking over the code, definitely intrigued by this approach. Excited for later when I can play around a bit in the repl and get a feel for it. Keep up the creativity!
Let me know any feedback you have 🙂
Hello all, sorry about my silly question, but I saw many examples, but nothing with re-frame/reagent to clear explain how do I use the select
with option
with re-frame/reagent? How to set :value
and :on-change
, is that the same as input
?
I have an effect handler (`reg-fx`). I want to store the item that is created in the effect in the db
. What is the best way to do this?
@fabrao Should be the same, yeah.
@erwinrooijakkers Effects can cause side-effects, so you can just use (reset! db some-new-db-value)
. For an example you can look the the :db
effect handler implementation.
Okay I injected the effects via cofx into a reg-event-db
, but it is a bit much indirection
If reg-event-fx
can just create some stuff and add it to the database it is clearer
E.g.,
(re-frame/reg-event-fx
:initialize
[(re-frame/inject-cofx :one-thing-that-uses-my-value)
(re-frame/inject-cofx :another-thing-that-uses-one-thing-obtained-from-cofx)]
(fn [{:keys [db one-thing another-thing] :as cofx} [_ my-value]]
{:db (assoc db
::one-thing one-thing
::another-thing another-thing)}))
And I meant creating the stuff in a let
block and then associng it to the db is clearer