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

React - onClick and alert

0 votes
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'); }}>


Please log in or register to response this reference. - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.