title: Error: Expected onClick listener to be a function, instead got type object using reactjs
body: <p>I am using an onClick function and trying to also pass an object with it. I need the object to make the function work. But for some reason it is giving me this error.</p>
  
  <p>The error is coming from the onClick function from the delete button that I am rendering on each comment. If I remove the comment I am passing with it the error goes away (so the function itself is not the problem). I am not sure if I am passing the comment through wrong or what. </p>
  
  <p>As I usually do if you request more information or want me to try to console log something I will put it in an edit so the comments do not get crowded and it will be easier for others to see.</p>
  
  <pre><code>    renderCommentsButtons(comment) {
      const { post, user, auth } = this.props;
  
      if(!user) {
        return (&lt;div&gt;&lt;/div&gt;);
      }
  
      if(auth) {
        if(user._id === comment.author.id) {
          return (
            &lt;div&gt;
              &lt;button
                onClick={this.deleteComment, comment}
                className="btn btn-xs btn-danger"&gt;
                Delete
              &lt;/button&gt;
              &lt;Link
                to={`/posts/${post._id}/comments/${comment._id}/edit`}
                className="btn btn-xs btn-warning"&gt;
                Edit
              &lt;/Link&gt;
            &lt;/div&gt;
          )
        }
      }
    }
  
    renderComments() {
      const { post } = this.props;
  
      return post.comments.map((comment) =&gt; {
        return (
          &lt;li className="list-group-item" key={comment._id}&gt;
            &lt;div&gt;
              {comment.text} : {comment.author.email}
            &lt;/div&gt;
            {this.renderCommentsButtons(comment)}
          &lt;/li&gt;
        );
      });
    }
  
    deleteComment({ author, _id}) {
      const {id} = this.props.match.params;
      const {user} = this.props;
  
      if(this.props.auth) {
        if(user._id === author.id){
          this.props.deleteComments(id, _id, () =&gt; {
            this.props.history.push(`/posts/${id}`);
          });
        }
      }
    }
  </code></pre>