This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-29
Channels
- # announcements (8)
- # aws (34)
- # beginners (92)
- # calva (19)
- # capetown (1)
- # cider (10)
- # cljs-dev (7)
- # cljsrn (11)
- # clojars (7)
- # clojure (130)
- # clojure-europe (4)
- # clojure-italy (4)
- # clojure-losangeles (1)
- # clojure-nl (11)
- # clojure-russia (1)
- # clojure-spec (4)
- # clojure-uk (64)
- # clojurescript (51)
- # cursive (9)
- # data-science (6)
- # datomic (29)
- # emacs (3)
- # figwheel-main (14)
- # fulcro (4)
- # graphql (3)
- # jackdaw (2)
- # jobs (4)
- # kaocha (17)
- # leiningen (3)
- # luminus (1)
- # off-topic (46)
- # pedestal (6)
- # portkey (2)
- # re-frame (6)
- # reagent (1)
- # reitit (9)
- # shadow-cljs (9)
- # sql (10)
- # yada (6)
Hey everyone, I have a couple questions . Has any of you needed to perform some logic on the view file (where you write your hiccup-like markup)? I'm trying to render a table but I'd like to show some links on the table based on some logical conditions i.e. my row data has to meet a certain criteria for a link to show on that row. Where's the best place add this logic, is it on my view file, subs file or events file? Or should I create a utility file, add my logic function there then require it in my view? Thanks
@mark.ekisa_slack_cloj I would keep all rendering logic that isn't stateful changing in the subs. Logic that changes the state of your app-db should go in events. Try to keep the rendering logic (your view file) as simple as possible, ideally just taking a map (or seq of maps) and rendering. Personal call, but I only put things that are not dependent on app-db in in utils (examples are a little thinger to highlight every other line per row in a table; it alternates highliting, but it doesen't actually depend on the value of each row (although I guess, pedantically, it does depend on the number of rows 🙂 )).
I have a riddle for you guys! A friend of mine is moving from a rum app with (an 'interesting' home-rolled state mechanism) over to re-frame (and thus reagent). So, they want to have a reagent component inside of a rum component tree. I came up with a solution but I'm not sure if it's good, or if there's a better one. Can any of you think of a good way to do it?