0

When I console.log the parameters of handleClick i get the message in inspect element (console section) this message.

{ "dispatchConfig": null, "_targetInst": null, "nativeEvent": null, "type": null, "target": null, "eventPhase": null, "bubbles": null, "cancelable": null, "defaultPrevented": null, "isTrusted": null, "view": null, "detail": null, "screenX": null, "screenY": null, "clientX": null, "clientY": null, "pageX": null, "pageY": null, "ctrlKey": null, "shiftKey": null, "altKey": null, "metaKey": null, "button": null, "buttons": null, "_dispatchListeners": null, "_dispatchInstances": null }

Here is the code:

export default class Button extends React.Component {
  static propTypes = {
    name: PropTypes.string,
    orange: PropTypes.bool,
    wide: PropTypes.bool,
    clickHandler: PropTypes.func,
  };

  handleClick = (abc) => {
    this.props.clickHandler(this.props.name);
    console.log ( abc)
  
  };
  

  render() {
    const className = [
      "component-button",
      this.props.orange ? "orange" : "",
      this.props.wide ? "wide" : "",
    ];

    return (
    
      <div className={className.join(" ").trim()}>
        <button onClick={this.handleClick}>{this.props.name}</button>
      </div>
    );
  }
}

Why am I getting this message in console? Thanks in advance.

senix
  • 31
  • 2
  • you are not passing any parameter to the handleClick. please try like this {() => this.handleClick(abc)} – Sain Pradeep Aug 24 '22 at 09:50
  • Can you add me on Instagram to ask you some questions, if you have time, please? I would appreciate it a lot. – senix Aug 24 '22 at 10:31

0 Answers0