title: ref does not work in this reactjs component
body: <p>I want to change the css class of a <code>span</code> element whenever an anchor  is clicked</p>
  
  <p>I will modify the css class in the onclick callback</p>
  
  <pre><code>class Button extends Component {
    handleCallback() {
      this.icon.className = this.icon.className + ' wiggle'
    }
    render() {
      return (
        &lt;div&gt;
          &lt;span className='highlight'&gt;{this.props.summary}&lt;/span&gt;
          &lt;a  
            className='link'
            onClick={this.handleCallback}
          &gt;   
            &lt;span ref={(c) =&gt; this.icon = c} className='icon-up'&gt;&lt;/span&gt;
          &lt;/a&gt;
  
        &lt;/div&gt;
      );  
    }
  }
  </code></pre>
  
  <p>To do so I need to be able to refer the component. That's why I use the <code>ref</code> attribute in the span class.</p>
  
  <p>However when the callback is called, I got this error:</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'icon' of null
  </code></pre>
  
  <p>Why the <code>ref</code> does not work here?</p>