Skip to content

Commit

Permalink
Redux-Based UI
Browse files Browse the repository at this point in the history
  • Loading branch information
15Dkatz committed Oct 23, 2022
1 parent 13cf539 commit 08f2c8a
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion evens-or-odds/src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { startGame, cancelGame } from '../actions/settings';

class App extends Component {
startGame = () => {
this.props.dispatch(startGame())
}

cancelGame = () => {
this.props.dispatch(cancelGame())
}

render() {
console.log('this', this);

return (
<div>React App</div>
<div>
<h2>♡ ♤ Evens or Odds ♢ ♧</h2>
{
this.props.gameStarted ? (
<div>
<h3>The game is on!</h3>
<br />
<button onClick={this.cancelGame}>Cancel Game</button>
</div>
) : (
<div>
<h3>A new game awaits</h3>
<br />
<button onClick={this.startGame}>Start Game</button>
</div>
)
}
</div>
);
}
}
Expand Down

0 comments on commit 08f2c8a

Please sign in to comment.