Web
Analytics
Events in React | Angular | ASP.NET Tutorials

For Consultation : +91 9887575540

Stay Connected :

Events in React

import React, { Component } from 'react'

export class Eventex extends Component {
    myevent =() => {
        console.log(this)
        console.log('Myevent is called');
    }
    sendarg=(a,b)=> {
          console.log('Your Argument is '+a +" "+b)
    }
    method = (a) =>
    {
        console.log('Method is called with value '+a)
    }
    render() {
        return (
            <div>
                <button onClick={this.myevent}>Call Event</button>
                <button onClick={()=>{ console.log('Internal evenet is called')}}>Internal Evenet</button>
                <button onClick={()=>this.sendarg("Arg1","Arg2")}>Send Argument</button>
                <button onClick={this.method.bind(this, 'Arg1')}>Event Binding</button>
            </div>
        )
    }
}

export default Eventex