react random number
function Random(props) {
var maxNumber = 45;
var randomNumber = Math.floor((Math.random() * maxNumber) + 1);
return <div>{randomNumber}</div>;
}
react random number
function Random(props) {
var maxNumber = 45;
var randomNumber = Math.floor((Math.random() * maxNumber) + 1);
return <div>{randomNumber}</div>;
}
random reacths
class Button extends React.Component {
constructor(props) {
super(props);
this.state = {
random: 0
}
}
render() {
var min = 1;
var max = 100;
var rand = min + (Math.random() * (max-min));
handleClick() {
this.setState ({this.state.random + this.rand})
}
return (
<div>
<button value="Click me!" onClick={this.handleClick.bind(this)></button>
</div>
);
React.render(<Button />, document.querySelector('#container'));
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us