import React, { useState, useEffect } from "react"
import './Target.css';
function randomNumber() {
const num = Math.floor(Math.random() * 80);
return num;
}
function Header(props) {
return (
Targets hit: {props.count}
Seconds left: {props.seconds}
);
}
function Target(props) {
const [style, setStyle] = useState({
position: 'absolute',
top: '50%',
right: '50%'
});
return (
);
}
function GameOver(props) {
return (
Finish!
You hit {props.count} targets in the span of 30 seconds!
);
}
function Game(props) {
const [count, setCount] = useState(0);
useEffect(() => {
const timer = setTimeout(() => {
if (props.seconds > 0) {
props.setSeconds(props.seconds - 1);
} else {
clearTimeout(timer);
}
}, 1000);
});
if (props.seconds !== 0) {
return (
);
}
return (
);
}
function Intro(props) {
const [temp, setTemp] = useState(30);
return (
);
}
export default function App() {
const [show, setShow] = useState(false);
const [seconds, setSeconds] = useState(30);
if (show) {
return
}
return
}