Reputation: 21
I'm having some problem to get height of a dynamic created div. This div does not have css height property defined. I'm using React JS. I tried use jQuery, pure javascript and React tools to get DOM Node, but the result is always 0. If i try $(....).height() at console, the value is showed correctly. Anyone can help me? Thanks.
Upvotes: 1
Views: 2690
Reputation: 21
I realized that the problems is with react life cycles. I created a new question about it. ReactJS - ComponentDidMount is executing before render
Upvotes: 0
Reputation: 845
I've created a tiny fiddle to reproduce your issue and it's reading the height properly. Notice, that i'm using reacts ref
attribute and ReactDOM.findDOMNode()
to access the <div>
.
https://jsfiddle.net/03ejh9yk/3/
https://facebook.github.io/react/docs/more-about-refs.html
https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode
Upvotes: 1