Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

React - onClick and alert

0 votes
10 views
added Mar 8 in React by LC Marshal Lieutenant (16,990 points)
class Square extends React.Component {
  render() {
    return (
‚Äč     //using arrow function syntax
      <button className="square" onClick={() => alert('click')}>
      //equivelant to
      //<button className="square" onClick={function() {alert ('i get clicked'); }}>
        {this.props.value}
      </button>
    );
  }
}

 

Please log in or register to response this reference.

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...