File tree 2 files changed +15
-11
lines changed
2 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -4,22 +4,26 @@ import { useSelector } from 'react-redux'
4
4
const GameScreen = ( ) => {
5
5
const userActions = useSelector ( store => store . games . username )
6
6
// console.log(userActions)
7
-
7
+
8
8
const games = useSelector ( store => store . games . username . actions )
9
+ // const games = useSelector(store => store.games)
9
10
console . log ( games )
10
11
12
+
13
+ //The optional chaining operator (?.)
14
+ //enables you to read the value of a property located deep within
15
+ //a chain of connected objects without having to check that each reference
16
+ //in the chain is valid.
11
17
return (
12
18
< div >
13
19
< h3 > { userActions . description } </ h3 >
14
- { /* <p>{games.description}</p> */ }
15
- { /* {userActions.map(action => (
16
- <button
17
- key={action}
18
- onClick=""
19
- >
20
- {action}
21
- </button>
22
- ))} */ }
20
+ { games ?. map ( ( game , index ) => (
21
+ < div key = { index } >
22
+ < p > { game . description } </ p >
23
+ < button > { game . direction } </ button >
24
+ </ div >
25
+ )
26
+ ) }
23
27
</ div >
24
28
)
25
29
}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ export const games = createSlice({
5
5
initialState : {
6
6
coordinates : null ,
7
7
description : null ,
8
- actions :[ ] ,
8
+ // actions:[],
9
9
username : ''
10
10
} ,
11
11
reducers : {
You can’t perform that action at this time.
0 commit comments