Return to Snippet

Revision: 70365
at January 23, 2016 06:28 by heathbo

Initial Code
getCoordinates: function(){
  var dropMen = this.refs.targetDiv.getDOMNode();
  var specs = dropmen.getBoundingClientRect();

render: function(){
  return <div ref="targetDiv"></div>

Initial URL

Initial Description
Use ref with getDOMNode() to get the actual html.  
Using getBoundingClientRect() on the actual html will give you the width, height, etc.

specs =  ClientRect {} bottom: 269 height: 18 left: 797.546875 right: 1062.609375 top: 251 width: 265.0625__proto__: ClientRect

console.log(specs.bottom) will return 269

Initial Title
React:  Get width, height, and coordinates of a react object

Initial Tags

Initial Language