File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
evens-or-odds/src/components Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { fetchNewDeck } from '../actions/deck';
55import fetchStates from '../reducers/fetchStates' ;
66import Instructions from './Instructions' ;
77import DrawCard from './DrawCard' ;
8+ import Card from './Card' ;
89
910class App extends Component {
1011 startGame = ( ) => {
@@ -34,6 +35,8 @@ class App extends Component {
3435 < br />
3536 < DrawCard />
3637 < hr />
38+ < Card />
39+ < hr />
3740 < button onClick = { this . props . cancelGame } > Cancel Game</ button >
3841 </ div >
3942 ) : (
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { connect } from 'react-redux' ;
3+
4+ const Card = ( { cards } ) => {
5+ if ( ! cards [ 0 ] ) return null ;
6+
7+ const { value, suit, image } = cards [ 0 ] ;
8+
9+ return (
10+ < div >
11+ < h3 > { value } of { suit } </ h3 >
12+ < img src = { image } alt = 'card-image' />
13+ </ div >
14+ ) ;
15+ }
16+
17+ export default connect (
18+ ( { deck : { cards } } ) => ( { cards } )
19+ ) ( Card ) ;
You can’t perform that action at this time.
0 commit comments