Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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>;
  }
}
Source by pt-br.reactjs.org #
 
PREVIOUS NEXT
Tagged: #react #prototype #function
ADD COMMENT
Topic
Name
1+1 =