diff --git a/src/index.js b/src/index.js index a861be0..a22141b 100644 --- a/src/index.js +++ b/src/index.js @@ -2,10 +2,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; -/*TODO - - When no one wins, display a message about the result being a draw. -*/ function Square(props) { const classNames = ['square']; @@ -156,6 +152,11 @@ function calculateWinState(squares) { return {winner: squares[a], line: lines[i]}; } } + + if (squares.every(square => !!square)) { + return {winner: 'Draw :/', line: []}; + } + return null; }