react event listener
import React, { Component } from 'react';
class App extends Component {
constructor(props) {
super(props);
this.sayHello = this.sayHello.bind(this);
}
sayHello() {
alert('Hello!');
}
return (
<button onClick={this.sayHello}>
Click me!
</button>
);
}
export default App;import React from 'react';
const App = () => {
const message = () => {
console.log("Hello World!")
}
return (
<button onClick={message}> Press me to print a message! </button>
);
}import React from 'react';
function App() {
function sayHello() {
alert('Hello!');
}
return (
<button onClick={sayHello}>
Click me!
</button>
);
}
export default App;<button onClick={sayHello}>Click</button>// it a component
import React from 'react';
class App extends React.Component {
//call function (ECMAScript 5) from tag input:text
handleChange = e => {
//
console.log(`${e.target.value}`)
}
render() {
return (
<div className="App">
<input type="text" name="input" id="" placeholder="" onChange={this.handleChange}/>
</div>
);
}
}
export default App;onClick onContextMenu onDoubleClick onDrag onDragEnd onDragEnter onDragExit
onDragLeave onDragOver onDragStart onDrop onMouseDown onMouseEnter onMouseLeave
onMouseMove onMouseOut onMouseOver onMouseUp
Also in JavaScript:
- sorting array of objects in javascript by using select option
- how to access nested objects in javascript
- javascript difference between window and Window
- drupal 8 render node programmatically
- sum of odd numbers in an array javascript without loop
- vue-sfc-rollup external dependency
- add discord.js library
- javascript coding interview questions github
- onPress image react native
- js string replace
- How can I display an image and text from an array on a webpage? Ask Question
- Flip a coin
- how use modal in login button click in react js
- javascript exercism.io bob solution
- npm http angular
- should i use google pay
- arithmetic expressions in scheme
- angularjs filter array of objects based on name prop
- keep-alive vuejs router
- javascript while
- convert string to array js
- javvascript convert boolean to string
- add class jquery
- change font js