Skip to content

Commit

Permalink
DrawCard Component
Browse files Browse the repository at this point in the history
  • Loading branch information
15Dkatz committed Oct 24, 2022
1 parent 4d07bda commit 4216bd7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
7 changes: 5 additions & 2 deletions evens-or-odds/src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { startGame, cancelGame } from '../actions/settings';
import { fetchNewDeck } from '../actions/deck';
import fetchStates from '../reducers/fetchStates';
import Instructions from './Instructions';
import DrawCard from './DrawCard';

class App extends Component {
startGame = () => {
Expand Down Expand Up @@ -31,6 +32,8 @@ class App extends Component {
<div>
<h3>The game is on!</h3>
<br />
<DrawCard />
<hr />
<button onClick={this.props.cancelGame}>Cancel Game</button>
</div>
) : (
Expand All @@ -52,8 +55,8 @@ const mapStateToProps = state => {
console.log('state', state);

const {
settings: { fetchState, message },
deck: { gameStarted }
settings: { gameStarted },
deck: { fetchState, message }
} = state;

return { gameStarted, fetchState, message };
Expand Down
16 changes: 16 additions & 0 deletions evens-or-odds/src/components/DrawCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import { connect } from 'react-redux';

const DrawCard = props => {
console.log('DrawCard props', props);

return (
<div>
<button>Draw the next card!</button>
</div>
)
}

export default connect(
({ deck: { deck_id } }) => ({ deck_id })
)(DrawCard);

0 comments on commit 4216bd7

Please sign in to comment.