title: React, how to access the DOM element in my render function from the same component
body: <p>I'm wondering what's the best practice for accessing the DOM elements inside my render function from the same component. Note that I will be rendering this component multiple times on a page.</p>
  
  <p>e.g. </p>
  
  <pre><code>var TodoItem = React.createClass({
      ...
      render:function(){
  
          function oneSecLater(){
              setTimeout(function(){
              //select the current className? this doesn't work, but it gives you an idea what I want.
              document.getElementsByClassName('name').style.backgroundColor = "red";
                  )}, 1000);
          }
  
          return(
              &lt;div className='name'&gt;{this.oneSecLater}&lt;/div&gt;
          )
  
  
  
  })
  </code></pre>