diff --git a/src/components/Game.js b/src/components/Game.js index 58c9d2c..a6fcd86 100644 --- a/src/components/Game.js +++ b/src/components/Game.js @@ -483,10 +483,12 @@ const Game = () => { setDrawCardPile([...copiedDrawCardPileArray]) } //else add the drawn card to player1's deck - //set new state - setTurn('Player 2') - setPlayer1Deck([...player1Deck.slice(0, player1Deck.length), drawCard, ...player1Deck.slice(player1Deck.length)]) - setDrawCardPile([...copiedDrawCardPileArray]) + else { + //set new state + setTurn('Player 2') + setPlayer1Deck([...player1Deck.slice(0, player1Deck.length), drawCard, ...player1Deck.slice(player1Deck.length)]) + setDrawCardPile([...copiedDrawCardPileArray]) + } } else { //remove 1 new card from drawCardPile and add it to player2's deck (immutably) @@ -557,10 +559,12 @@ const Game = () => { setDrawCardPile([...copiedDrawCardPileArray]) } //else add the drawn card to player2's deck - //set new state - setTurn('Player 1') - setPlayer2Deck([...player2Deck.slice(0, player2Deck.length), drawCard, ...player2Deck.slice(player2Deck.length)]) - setDrawCardPile([...copiedDrawCardPileArray]) + else { + //set new state + setTurn('Player 1') + setPlayer2Deck([...player2Deck.slice(0, player2Deck.length), drawCard, ...player2Deck.slice(player2Deck.length)]) + setDrawCardPile([...copiedDrawCardPileArray]) + } } } diff --git a/src/components/Homepage.js b/src/components/Homepage.js index 58fe20c..0819410 100644 --- a/src/components/Homepage.js +++ b/src/components/Homepage.js @@ -1,21 +1,13 @@ import React from 'react' import { Link } from 'react-router-dom' -import { START_GAME } from '../store/actions' -import { connect } from 'react-redux' -const Homepage = (props) => { +const Homepage = () => { return (