Dapatkan tombol ID yang diklik React

class Button extends React.Component {

  handleId = (e) => {
   /*Well if the elements are nested event.target won't always work
     since it refers to the target that triggers the event in the first place.*/
    console.log(e.target.id);
    console.log(e.currentTarget.id);
  }

  render() {
    return (
      <button id="yourID" onClick={this.handleId}>Button</button>
    );
  }
}
abdelghanyMh