parameters for calling react component code example
Example 1: react bind function to component
class Foo extends Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick() {
console.log('Click happened');
}
render() {
return <button onClick={this.handleClick}>Click Me</button>;
}
}
Example 2: class component params in react
<input
type= "text"
value={ this.state.value || "" }
placeholder="Enter Name"
/>