Fork me on GitHub
#reagent
<
2016-12-14
>
ericfode00:12:03

@yogthos Thank you for Macchiato

yogthos01:12:00

@ericfode thanks, having a blast working on it 🙂

cmal11:12:24

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?

manishkumarmdb12:12:18

@cmal get the height and width of an element, what it means ?

cmal12:12:54

get the height and width of a dom element, like jquery's height() width()

cmal12:12:13

sorry for that

mccraigmccraig12:12:15

@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

cmal12:12:23

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?

lxsameer12:12:41

how can i pass a react element as a prop to other elements in reagent ?

mccraigmccraig12:12:40

@cmal you don't need jayq - (.offsetHeight node) and (offsetWidth node) will give you the height and width of the element

lxsameer12:12:44

I need something similar to <C1 icon={<ICON />}>

juhoteperi13:12:13

@terje & others: Cljsjs doesn't make much sense when writing code for Node, it is better to just use npm modules in that case.

juhoteperi13:12:47

And in Node there is no need for externs because one doesn't usually use advanced optimization with Node (as far as I know)

terje19:12:35

@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.