From 529849fabcfafaac573de22b1aa550c3df5b898e Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Mon, 19 Jul 2021 19:55:20 +0530 Subject: Implemented an alternative for alert() so now it works on more browsers --- src/components/App.tsx | 6 +++++- src/components/Grid.tsx | 12 +++++++----- src/components/MessageBox.tsx | 35 +++++++++++++++++++++++++++++++++++ src/components/style.css | 21 +++++++++++++++++++++ 4 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 src/components/MessageBox.tsx diff --git a/src/components/App.tsx b/src/components/App.tsx index 19d1e8c..141b332 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -17,6 +17,7 @@ */ import React, { useState } from 'react'; +import MessageBox from './MessageBox'; import ScoreBoard from './ScoreBoard'; import Grid from './Grid'; import Footer from './Footer'; @@ -25,10 +26,13 @@ import './style.css'; const App: React.FC = () => { const [scoreX, setScoreX] = useState(0); const [scoreO, setScoreO] = useState(0); + const [showMessageBox, setShowMessageBox] = useState(false); + const [message, setMessage] = useState(""); return ( <> + {showMessageBox && } - +