Last active
August 28, 2018 22:03
-
-
Save hasparus/1a2e8e87b30b6ef08a629f007fdf73c7 to your computer and use it in GitHub Desktop.
NaN
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'; | |
type Entity = { | |
name: string; | |
strength: number; | |
}; | |
type Props = { | |
player: Entity; | |
enemy: Entity; | |
}; | |
export const GameLevelStateless = ({ player, enemy }: Props) => ( | |
<main>{player.strength - enemy.strength}</main> | |
); | |
type State = { | |
score: number; | |
}; | |
export class GameLevelClass extends React.Component<Props, State> { | |
state = { | |
score: 5, | |
}; | |
render() { | |
return <GameLevelStateless {...this.props} />; | |
} | |
} | |
export default GameLevelClass; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment