battleship-front/src/components/Ready.js
Administrator 3d71f5dee6 fixes
2022-08-25 20:23:46 +03:00

35 lines
854 B
JavaScript

import { Component } from "react";
class Ready extends Component {
constructor(props) {
super(props);
this.state = {
text: "Расставь корабли чтобы активировать",
disabled: true,
parent: props.parent
}
}
update() {
if (!this.props.ok) {
this.setState({
text: "Расставь корабли чтобы активировать",
disabled: true
})
}
else {
this.setState({
text: "Я готов",
disabled: false
})
}
}
render() {
return <button onClick={this.props.onClick} className='main' disabled={this.props.disabled}><p>{this.props.text}</p></button>
}
}
export default Ready;