---
# System prepended metadata

title: Untitled

---

## code Yassien's changes

```javascript=
import Button from "./Button";
import Actions from "./Actions";
import { useState, useEffect } from "react";
import * as deckModule from "../Helper/cards.js";



function Game() {
  const [deck, setDeck] = useState([]);//[value, setValue]
  const [playerCards, setPlayerCards] = useState([]);
  const [dealerCards, setDealerCards] = useState([]);
  const [gameIsStarted, setgameIsStarted] = useState(false);
  useEffect(() => {
    console.log(deckModule.generateDeck());
    setDeck(deckModule.generateDeck()); //52
  }, [])





  const getStartingCards = () => {
    const { randomCard, updatedDeck } = deckModule.getRandomCard(deck);
    console.log(randomCard, ' random card', updatedDeck, 'updated deck');
    const { randomCard: randomCard2, updatedDeck: updatedDeck2 } = deckModule.getRandomCard(updatedDeck);
    console.log(randomCard2, ' random card2', updatedDeck2, 'updated deck2');
    setPlayerCards([randomCard, randomCard2]);
    setgameIsStarted(true);
  }


  const startGame = () => {
    // console.log(deckModule.generateDeck());
    // setDeck(deckModule.generateDeck()); //52
    getStartingCards();
    //console.log(playerCards, 'player card', deck)

  }


  return (
    <div>
      <Actions />
      {!gameIsStarted ? <Button click={startGame}>Start Game</Button> : null}

      {playerCards.length != 0 ? <p>{playerCards[0].number}</p> : null}
    </div>
  );

}

export default Game;
```