How to handle events in ReactJs

In this post we will discuss about reactjs important events which are very useful to develop any application. firstly we give example onclick event in reactjs .In onlclick we called a function and print log .
import React, { Component } from ‘react’;
import ‘./App.css’;
import User from ‘./User/User’;
import Profile from ‘./Profile/Profile’;
class App extends Component {
updateUserName( ){
console.log(“updateUserName Called”);
}
render() {
return (
<divclassName=”App”>
<h1> My react application </h1>
<buttononClick={this.updateUserName}>Update User Name</button>
</div>
);
}
}
export default App;
These are other reactjs events as

Leave a Reply

Your email address will not be published. Required fields are marked *

+ 46 = 49