JavaScript Error: Expected onClick listener to be a function, instead got type object using reactjs

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.

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.

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.

    renderCommentsButtons(comment) {
    const { post, user, auth } = this.props;

    if(!user) {
      return (<div></div>);
    }

    if(auth) {
      if(user._id === comment.author.id) {
        return (
          <div>
            <button
              onClick={this.deleteComment, comment}
              className="btn btn-xs btn-danger">
              Delete
            </button>
            <Link
              to={`/posts/${post._id}/comments/${comment._id}/edit`}
              className="btn btn-xs btn-warning">
              Edit
            </Link>
          </div>
        )
      }
    }
  }

  renderComments() {
    const { post } = this.props;

    return post.comments.map((comment) => {
      return (
        <li className="list-group-item" key={comment._id}>
          <div>
            {comment.text} : {comment.author.email}
          </div>
          {this.renderCommentsButtons(comment)}
        </li>
      );
    });
  }

  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, () => {
          this.props.history.push(`/posts/${id}`);
        });
      }
    }
  }
Answer:1

I have 2 challenges, On page load, I would like to show a warning saying that "caps is on". Still the user press the shift + key or Caps on + key - I would like to through error. I search in google ...

I have 2 challenges, On page load, I would like to show a warning saying that "caps is on". Still the user press the shift + key or Caps on + key - I would like to through error. I search in google ...

I am currently setting up a Heroku deployment. Everything works fine when it is run locally but I get the following error from Heroku. at=info method=GET path="/" host=pure-cliffs-68507.herokuapp.com ...

I am currently setting up a Heroku deployment. Everything works fine when it is run locally but I get the following error from Heroku. at=info method=GET path="/" host=pure-cliffs-68507.herokuapp.com ...

  1. internal server error 500
  2. internal server error meaning
  3. internal server error uber eats
  4. internal server error /swagger/v1/swagger.json
  5. internal server error wordpress
  6. internal server error 43531
  7. internal server error code
  8. internal server error 500 meaning
  9. internal server error spectrum
  10. internal server error api gateway
  11. internal server error 43549
  12. internal server error heroku
  13. internal server error nextcloud
  14. internal server error flask
  15. internal server error league of legends
  16. internal server error apex
  17. internal server error message
  18. internal server error 500 wordpress
  19. internal server error salesforce
  20. internal server error yahoo mail

I am using the following angular binding on an input: <li data-ng-repeat="value in model.Values"> <input type="number" data-required data-min="-10" data-max="10" ...

I am using the following angular binding on an input: <li data-ng-repeat="value in model.Values"> <input type="number" data-required data-min="-10" data-max="10" ...

  1. conditional value input
  2. ng-class conditional input value
  3. html input value conditional
  4. angular input value conditional
  5. angular 2 conditional input value
  6. angularjs conditional input value

WhY this notation does not work const result1 = _model['dataarray[0]']; _model.dataarray exists and it is an array with 2 elements this "console.log(_model.dataarray[0])" works fines

WhY this notation does not work const result1 = _model['dataarray[0]']; _model.dataarray exists and it is an array with 2 elements this "console.log(_model.dataarray[0])" works fines

  1. data binding with livedata android
  2. data binding with fragments android
  3. data binding with textbox in c#
  4. data binding with recyclerview
  5. data binding with include layout
  6. data binding with viewmodel android
  7. data binding with mvvm android
  8. data binding with kotlin
  9. data binding with tabular data control
  10. data binding with recyclerview kotlin
  11. data binding with ngmodel
  12. data binding with web
  13. data binding with viewmodel
  14. data binding with androidx
  15. data binding with mvvm
  16. data binding with live data
  17. data binding with fragments
  18. data binding with windows forms
  19. data binding with jquery
  20. data binding with edittext android