diff --git a/evens-or-odds/src/components/App.js b/evens-or-odds/src/components/App.js index 73e6b03..df609e3 100644 --- a/evens-or-odds/src/components/App.js +++ b/evens-or-odds/src/components/App.js @@ -3,14 +3,6 @@ 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); @@ -22,13 +14,13 @@ class App extends Component {

The game is on!


- +
) : (

A new game awaits


- +
) } @@ -43,6 +35,13 @@ const mapStateToProps = state => { return { gameStarted: state.gameStarted }; } -const componentConnector = connect(mapStateToProps); +const mapDispatchToProps = dispatch => { + return { + startGame: () => dispatch(startGame()), + cancelGame: () => dispatch(cancelGame()), + }; +} + +const componentConnector = connect(mapStateToProps, mapDispatchToProps); export default componentConnector(App);