title: How to call setState function onClick ES6 way
body: <pre><code>class BlogPost extends React.Component{
      //getInitialState
      constructor(){
          super();
          this.onLike = this.onLike.bind(this);
          this.state = {
              like :0
          }
      }
  
      onLike(){
          this.setState({
              like: this.state.like++ 
          });
      }
  
      render(){
          var postListItem = this.props.postList.map(function(post){
              return &lt;li&gt;&lt;a href="#"&gt; {post}&lt;/a&gt; &lt;/li&gt;
          });
          return (
              &lt;div className="blogPost"&gt;
                  &lt;h2&gt;Posts&lt;/h2&gt;
                  &lt;ul&gt;{postListItem}&lt;/ul&gt;
                  &lt;button onClick={(e) =&gt; {this.onLike}}&gt;{this.state.like}&lt;/button&gt;
              &lt;/div&gt;
          );
      }
  }
  </code></pre>
  
  <p>Nothing happens on clicking <code>Button</code>.
  There is no function on button and index.js has added Empty Function to it. IDK why?please explain</p>