parameter function in react code example
Example 1: how to call a function in react with arguments onclick
<button onClick={() => sayHello('James')}>Greet</button>
Example 2: react native function
class Foo extends Component {
handleClick() {
console.log('Click happened');
}
render() {
return <button onClick={this.handleClick.bind(this)}>Click Me</button>;
}
}