Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
93
rated 0 times [  97] [ 4]  / answers: 1 / hits: 20488  / 6 Years ago, thu, june 7, 2018, 12:00:00

I'm dynamically rendering a list of Symbol(react.element) by mapping into an array and placing each of its elements HTML tags. My question is therefore: how can I get the height of each of the rendered Symbol(react.element)? This seems not to be in the Symbol(react.element)'s object.



Thanks in advance for your help


More From » node.js

 Answers
9
 class MyComponent extends Component {
constructor(props){
super(props)
this.myDiv = React.createRef()
}

componentDidMount () {
console.log(this.myDiv.current.offsetHeight)
}

render () {
return (
<div ref={this.myDiv}>element</div>
)
}
}

[#54250] Monday, June 4, 2018, 6 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tajo

Total Points: 415
Total Questions: 124
Total Answers: 103

Location: North Korea
Member since Tue, Jun 16, 2020
4 Years ago
;