react button example
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';
function App() {
function sayHello() {
alert('Hello!');
}
return (
<button onClick={sayHello}>
Click me!
</button>
);
}
export default App;
Also in JavaScript:
- detect user browser javascript
- validate array javascript
- jquery addeventlistener
- javascript ... operator three dots
- how to use a function from another file in javascript
- cognito listUser using amazon-cognito-identity-js
- angular 9 form value changes
- javascript iterate through a binary tree
- Generate random whole numbers javascript
- how to add keyframe in emotion stled
- javascript full date as string
- using laravel variable inside alpine js
- js log to console
- style cards react
- callback in js
- javascript is single threaded
- js query string
- material ui align icon with text
- ruby on rails test if all parameters in json request are here
- immediate invoke function js
- react prototype function
- angular http call caching issue even after no-cache
- electron disable menu
- Replace function in string in javascript