Commit 946b0ed0 authored by s8_vaitku_e's avatar s8_vaitku_e
Browse files

Update Game.js

parent d2835312
import GuessTheNumber from 'components/guessTheNumber';
import './Game.scss';
const Game = () => {
return (
<div className="Game">
<section>
<GuessTheNumber />
</section>
</div>
);
};
export default Game;
import React, { Component } from 'react'
import Result from './Result'
class Game extends Component{
static defaultProps = {secret : Math.floor(Math.random() * 100) + 1}
constructor(props){
super(props)
this.state = { term : '' }
this.handleChange = this.handleChange.bind(this)
}
handleChange(event){
this.setState({
[event.target.name] : event.target.value
})
}
render(){
return (
<div>
<div>
<p>Vel neatjaunina minamo skaitli kad atminets (F5 lai atj.).</p>
<label htmlFor='term'>
<p>Mini skaitli no 1 lidz 100</p>
</label>
</div>
<input
id='term'
type='text'
name='term'
value={this.state.term}
onChange={this.handleChange}
/>
<Result term={this.state.term} secretNum={this.props.secret} />
</div>
)
}
}
export default Game
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment