title: How to change style using javascript in reactjs
body: <p>How to change style using javascript in reactjs</p>
  
  <pre><code>class Hello extends Component{
      constructor(props){
          super(props);
          this.state = {
          }
          this.handleClick = this.handleClick.bind(this);
      }
      handleClick() {
          document.getElementsByClassName("hello").style.color = 'red';
      }
      render(){
          return (
              &lt;div className="hello" onClick={this.handleClick}&gt;hello&lt;/div&gt;
          );
  
      }
  }
  
  ReactDOM.render(
      &lt;Hello/&gt;,
      document.getElementById('root')
  );
  </code></pre>
  
  <p>I am getting error</p>
  
  <blockquote>
    <p>TypeError: Cannot set property 'color' of undefined</p>
  </blockquote>