import React from "react"; import Store from "./interface/Store"; export default class WinStats extends React.Component { constructor() { super() this.state = { stats: Store.getGameStats(), hand: Store.getHand() } this.getStats = this.getStats.bind(this) this.color = ['charcoal', '#ff3333', '#32cd32', '#4F94CD'] } componentDidMount() { Store.on("gmestats", this.getStats) } componentWillUnmount() { Store.removeListener("gmestats", this.getStats) } getStats() { console.log('gmestats') this.setState({ stats: Store.getGameStats(), hand: Store.getHand() }) } newGame() { // Act.apiCall('service', 'NEWGME', {match: this.props.game}); this.props.newgame() } render() { const msg = this.state.stats.length > 0 ? this.state.stats.map((m) => { return