Answers for "react prototype function"

0

react prototype function

class Foo extends Component {
  constructor(props) {
    super(props);
    this.handleClick = this.handleClick.bind(this);
  }
  handleClick() {
    console.log('Clicado');
  }
  render() {
    return <button onClick={this.handleClick}>Clique em mim!</button>;
  }
}
Posted by: Guest on October-09-2020
0

react prototype function

<button onClick={this.handleClick}>
Posted by: Guest on October-09-2020
0

react prototype function

class Foo extends Component {
  // Nota: esta sintaxe é experimental e ainda não padronizada.
  handleClick = () => {
    console.log('Clicado');
  }
  render() {
    return <button onClick={this.handleClick}>Clique em mim!</button>;
  }
}
Posted by: Guest on October-09-2020
0

react prototype function

class Foo extends Component {
  handleClick() {
    console.log('Clicado');
  }
  render() {
    return <button onClick={this.handleClick.bind(this)}>Clique em mim!</button>;
  }
}
Posted by: Guest on October-09-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language