This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-18
Channels
- # bangalore-clj (1)
- # beginners (36)
- # boot (119)
- # braid-chat (16)
- # cider (14)
- # cljs-dev (34)
- # cljsrn (7)
- # clojars (9)
- # clojure (91)
- # clojure-austin (1)
- # clojure-bangladesh (1)
- # clojure-dusseldorf (5)
- # clojure-israel (1)
- # clojure-russia (3)
- # clojure-spec (6)
- # clojure-uk (7)
- # clojurescript (11)
- # community-development (1)
- # core-async (5)
- # cursive (6)
- # datomic (11)
- # dirac (12)
- # funcool (24)
- # leiningen (5)
- # luminus (5)
- # off-topic (2)
- # om (69)
- # om-next (16)
- # overtone (4)
- # perun (19)
- # re-frame (23)
- # reagent (38)
- # specter (7)
- # uncomplicate (9)
- # yada (4)
I have a problem setting up reactions in re-frame
in examples, they seem to de-reference db
while I have it de-referenced already
(reg-sub :panel-items (fn [db [_ panel]]
(println db)
(reaction (panel db))))
db is already a map
@yury.solovyov version 0.8.0 of re-frame changed subscriptions and I'm sorry that the docs are currently behind.
We're working on fixing that
In the meantime ... the best source of information is the todomvc example
This should make it clear: https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/subs.cljs
I'm about to use plain channels for this
BTW, there is also a dedicated re-frame channel
joined
The new way of doing things is even simpler than before:
(reg-sub
:panel-items
(fn [db [_ panel]]
(println db)
(panel db))) ;; <--- you no longer even need to return a reaction
yeah, I done that when I started
but I had a problem that I have to manually trigger change events to update components cause ratom didn't saw changes
here https://github.com/YurySolovyov/eion/blob/master/src/eion/renderer/core.cljs#L43
Hmm. Not sure what is going on there. But the code above is corret
Oh wait. Looking at your link
Hmm. That code is confusing me. You have your own app-db
?
I thought I have to
re-frame provides app-db
> From here on in this document, we'll assume app-db is one of these: (def app-db (reagent/atom {})) ;; a Reagent atom, containing a map
The reference implementation already creates and manages an internal app-db for you, you don't need to declare one yourself.
ok that explains something
Have a look at the two examples
As a next step
/examples
in the repo
yeah, I looked at them. Probably not long enough. What is confusing for me is that it has same names for subs and events
(reg-event-db
:time-color
isn't :time-color-changed
a better name?
Sounds quite reasonable
I'll change that to remove confusion. Always good to get feedback
thanks, I was about to give up on reframe and do it with plain reagent to unstuck. Will try again
Have a read through the examples and ask on re-frame channel
(Although I'm about to go to bed someone else will know over there)