function as props code example
Example 1: function component with props
import React from "react"
function Checkbox(props){
return (
<div>
<input type="checkbox" />
<label>{props.value}</label>
</div>
)
}
export default Checkbox
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>;
}
}