Skip to content

Instantly share code, notes, and snippets.

@hasparus
Last active August 28, 2018 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hasparus/1a2e8e87b30b6ef08a629f007fdf73c7 to your computer and use it in GitHub Desktop.
Save hasparus/1a2e8e87b30b6ef08a629f007fdf73c7 to your computer and use it in GitHub Desktop.
NaN
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