how to add functions in react code example
Example 1: react functional components
const component = () => {
console.log("This is a functional Component");
}
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>;
}
}