This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-05
Channels
- # beginners (29)
- # boot (29)
- # cider (54)
- # cljs-dev (99)
- # cljsjs (31)
- # cljsrn (39)
- # clojars (32)
- # clojure (171)
- # clojure-austin (2)
- # clojure-berlin (5)
- # clojure-brasil (3)
- # clojure-greece (2)
- # clojure-italy (1)
- # clojure-korea (11)
- # clojure-spec (202)
- # clojure-uk (166)
- # clojurescript (130)
- # cursive (54)
- # datomic (99)
- # dirac (18)
- # figwheel (6)
- # hoplon (23)
- # lambdaisland (3)
- # leiningen (8)
- # luminus (14)
- # off-topic (11)
- # om (3)
- # om-next (24)
- # onyx (59)
- # planck (25)
- # protorepl (10)
- # re-frame (49)
- # reagent (14)
- # ring-swagger (2)
- # rum (46)
- # schema (1)
- # slack-help (6)
- # specter (7)
- # testing (7)
- # untangled (115)
- # yada (1)
maybe a dumb question.. but how do i get a reference to the domnode created(using hoplon) by a regular fn or a defelem..? Most integrations with an existing js lib, requires the dom element as an input..
@cdine: the hoplon fns are simply constructors that return a dom element, so you can pass the element they return into any js lib that takes one.
@jumblerg , thanks.. that was straight forward.. let me give it a try.. Does hoplon.core/div create an (dom) element? Last time when i Poked around hoplon, when parentfn invokes childfn which has say (h/div "something") (h/div "something else") , it resulted in only the second div being rendered...
or more idiomatically using with-let
:
(hoplon.core/div
(javelin.core/with-let [node (hoplon.core/div)]
(js/some-lib-fn node)))
yes, the div
fn constructs a dom element and sets the attributes you pass it as properties on that element.
apologies if the questions are dumb, coming from a react background, trying to wrap my head around this and find it difficult to cut loose the old habits (think react lifecycle n stuff)
you can see how the element constructors work at: https://github.com/hoplon/hoplon/blob/master/src/hoplon/core.cljs#L408-L522
@cdine it’s because the hoplon functions return a dom element, so you can only return one from your function (like any other function) - but, a vector works
(defn foo [] (div) (div))
= bad, (defn foo [] [(div) (div)])
= ok
Yeah I realized right after I'd asked that question.. should be similar to how regular fns work ...
@cdine it confused me too for a while, i was overcomplicating things in my head
@dm3 i’ve never actually used react 😛 i’ve only heard about it from other ppl
hoplon has done everything i’ve needed so far