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';
5
5
import fetchStates from '../reducers/fetchStates' ;
6
6
import Instructions from './Instructions' ;
7
7
import DrawCard from './DrawCard' ;
8
+ import Card from './Card' ;
8
9
9
10
class App extends Component {
10
11
startGame = ( ) => {
@@ -34,6 +35,8 @@ class App extends Component {
34
35
< br />
35
36
< DrawCard />
36
37
< hr />
38
+ < Card />
39
+ < hr />
37
40
< button onClick = { this . props . cancelGame } > Cancel Game</ button >
38
41
</ div >
39
42
) : (
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