title: React.JS calculating img width in virtual DOM
body: <p>I'm trying to find the width of an <code>&lt;img&gt;</code> to center it via JavaScript.  </p>
  
  <p>Trying to calculate the width of this react.js DOM node returns 0.</p>
  
  <pre><code>var Player = React.createClass({
    componentDidMount:function(){
  
        var imgEl = this.refs.imgSize.getDOMNode();
  
        console.log(imgEl.offsetWidth);
    },
    render: function () {
      return (
        &lt;img ref="imgSize" src={this.props.imageURL} /&gt;
      );
    }
  });
  </code></pre>