Created
May 5, 2017 22:30
-
-
Save jakesorce/12fba24221be3781f29c6821f962830a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import Player from './Player'; | |
import Game from './Game'; | |
class Yahtzee extends React.Component { | |
state = { name: '', edit: true } | |
updatePlayer = (name) => { | |
this.setState({ name, edit: false }) | |
} | |
editPlayer = () => { | |
this.setState({ edit: true }); | |
} | |
render() { | |
let { state: { name, edit }, updatePlayer, editPlayer } = this; | |
return ( | |
<div> | |
{ edit ? | |
<Player handleSubmit={updatePlayer} name={name} /> | |
: | |
<Game player={name} editPlayer={editPlayer} /> | |
} | |
</div> | |
) | |
} | |
} | |
export default Yahtzee; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment