Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yunogasai committed Jul 4, 2024
1 parent 6b084fe commit 3206344
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/components/Stopwatch.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState, useRef, useEffect } from 'react';

const Stopwatch: React.FC = () => {
const [time, setTime] = useState<number>(0);
const [isRunning, setIsRunning] = useState<boolean>(false);
const [time, setTime] = useState(0);
const [isRunning, setIsRunning] = useState(false);
const intervalRef = useRef<number | null>(null);

useEffect(() => {
Expand All @@ -11,7 +11,7 @@ const Stopwatch: React.FC = () => {
};
}, []);

const startStop = (): void => {
const startStop = () => {
if (isRunning) {
if (intervalRef.current) clearInterval(intervalRef.current);
} else {
Expand All @@ -23,7 +23,7 @@ const Stopwatch: React.FC = () => {
setIsRunning(!isRunning);
};

const reset = (): void => {
const reset = () => {
if (intervalRef.current) clearInterval(intervalRef.current);
setTime(0);
setIsRunning(false);
Expand Down
2 changes: 1 addition & 1 deletion src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ button {
color:rgb(26, 26, 182);
}
html.dark {
background-color: #333;
background-color: #1E1E20;
}

0 comments on commit 3206344

Please sign in to comment.