This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-14
Channels
- # adventofcode (20)
- # arachne (11)
- # beginners (53)
- # boot (342)
- # cider (54)
- # cljs-dev (39)
- # cljsrn (4)
- # clojure (78)
- # clojure-brasil (2)
- # clojure-italy (5)
- # clojure-nl (4)
- # clojure-quebec (1)
- # clojure-russia (90)
- # clojure-sanfrancisco (4)
- # clojure-spec (55)
- # clojure-uk (27)
- # clojurescript (170)
- # core-async (1)
- # core-logic (1)
- # css (1)
- # cursive (8)
- # datomic (83)
- # dirac (5)
- # hoplon (24)
- # lambdaisland (1)
- # lein-figwheel (23)
- # midje (2)
- # off-topic (1)
- # om (4)
- # om-next (7)
- # onyx (74)
- # proton (1)
- # protorepl (22)
- # rdf (2)
- # re-frame (105)
- # reagent (15)
- # ring-swagger (3)
- # rum (4)
- # slack-help (17)
- # spacemacs (14)
- # untangled (62)
- # vim (4)
- # yada (18)
Hi! In reagent, is there a way to get the height and width of an element ? Or what is the recommended way to do that?
@cmal get the height and width of an element, what it means ?
@cmal you can get the DOM node of a mounted component with https://github.com/reagent-project/reagent/blob/master/src/reagent/core.cljs#L184 where this
is the param passed to type-3 component fns like :component-did-mount
Thanks. I want to get the height and width of the node, should I use jayq? or there is a react/reagent way of getting height and width of the node?
@cmal you don't need jayq - (.offsetHeight node)
and (offsetWidth node)
will give you the height and width of the element
Thank you @mccraigmccraig
@terje & others: Cljsjs doesn't make much sense when writing code for Node, it is better to just use npm modules in that case.
And in Node there is no need for externs because one doesn't usually use advanced optimization with Node (as far as I know)
@juhoteperi Cljsjs is indeed not much used for cljs on node - yet. However, there is more to cljsjs than externs: It allows the dependency to be declared in the ns. So using it makes sense. You can see cljsjs being used with node in reagent.dom.server which requires cljsjs.react.dom.server. The next version of the cljsjs.pubnub package (which I maintain) will likely also work on node as this javascript library recently has been made universal.