prototype in javascript react native code example
Example 1: react prototype function
<button onClick={this.handleClick}>
Example 2: 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>;
}
}