This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-19
Channels
- # admin-announcements (2)
- # aws-lambda (3)
- # beginners (66)
- # boot (61)
- # cider (1)
- # cljs-dev (17)
- # clojure (100)
- # clojure-austin (4)
- # clojure-brasil (1)
- # clojure-canada (8)
- # clojure-quebec (6)
- # clojure-russia (48)
- # clojure-sg (6)
- # clojure-spec (37)
- # clojure-uk (61)
- # clojure-ukraine (2)
- # clojurescript (80)
- # core-async (13)
- # cursive (20)
- # datascript (37)
- # datomic (2)
- # defnpodcast (4)
- # emacs (5)
- # funcool (3)
- # hoplon (11)
- # jobs (7)
- # juxt (26)
- # lein-figwheel (48)
- # leiningen (3)
- # luminus (3)
- # om (34)
- # om-next (5)
- # onyx (5)
- # protorepl (6)
- # re-frame (10)
- # reagent (9)
- # rethinkdb (16)
- # ring-swagger (5)
- # spacemacs (14)
- # specter (54)
- # untangled (36)
- # vim (75)
- # yada (1)
@currentoor: nice I've already written something very similar to boostrap.cljs there
@currentoor: so you append "Ui" right for the factory function?
@currentoor: it's too bad I can't get the @ReactClass syntax to work in advanced mode
@jasonjckn: yeah i've copied over that bootstrap macro too many times from project to project now 😄
your syntax does look cooler though but yeah i don't mind typing one extra character
nice 😄
it's on clojars by the way
my syntax also helped for writing generic code, e.g:
(def tabui-list
[ListingsTab
BookingsTab
MessagesTab
ReportsTab
TXJTab
SpaceTransferTab
InviteUserTab
CreateBookingTab
NewCollectionsTab])
(def which-tab->tabui
(zipmap (map #(:which-tab (initial-state % nil)) tabui-list)
tabui-list))
(defui TabUnion (map-vals get-query which-tab->tabui)
static Ident
(ident [T {:keys [which-tab]}] [which-tab :tab])
static InitialAppState
(initial-state [_ _] (initial-state MessagesTab))
Object
(navbar [T which-tab]
(nav {:bsStyle "pills"
:stacked true
:class "nav"
:activeKey which-tab
:onSelect #(transact! T [(app/choose-tab {:tab (keyword %)})
(history/commit)
:ui/react-key])}
(for [[which-tab tabui] which-tab->tabui]
(nav-item {:eventKey which-tab} (tab-title tabui)))))
(render [T]
(let [{:keys [which-tab]} (props T)]
(div
(.navbar T which-tab)
(div {:id "tabunion_content"}
(@(which-tab->tabui which-tab) (props T)))))))
if you have any good ideas i'm open to suggestions
yeah definitely, i'm trying to think of how i would do that
@currentoor: i was thinking of putting props as an argument into render function for sugar reasons
oh my god yes!
i've had the same thought every time i write a render method!
just been too lazy
i want destructuring to still work though
i've done something kind of similar in clojure land by wrapping an anonymous function, otherwise generic destructuring didn't work
i think i tried that initially but namespaced keywords didn't behave correctly
either way, if you get to it first definitely let me know, i'd love to add props as an argument to the render method
it'd be cool to make render variadic and allow (render [this]...)
or (render [this props]...)
or (render [this props state]...)
hmm, hadn't thought of computed props