Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/components/ui/Stopwatch/Stopwatch.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// src/components/ui/Stopwatch/Stopwatch.tsx

import { useEffect, useState } from 'react';

const Stopwatch = () => {
const [seconds, setSeconds] = useState(0);

useEffect(() => {
const interval = setInterval(() => {
setSeconds(seconds => seconds + 1);
}, 1000);

return () => clearInterval(interval);
}, []);

return (
<div>
Seconds: {seconds}
</div>
);
};

export default Stopwatch;
3 changes: 3 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { type AppType } from "next/app";
import ThemeProvider from "@components/ui/Theme/ThemeProvider";
import Stopwatch from "@components/ui/Stopwatch/Stopwatch"; // New import
import "../styles/globals.css";
import { QueryClient, QueryClientProvider } from "react-query";
import { v4 as uuid } from "uuid";
Expand All @@ -17,10 +18,12 @@ const MyApp: AppType = ({ Component, pageProps: { ...pageProps } }) => {
// Provide the client to your App
<ThemeProvider>
<QueryClientProvider client={queryClient}>
<Stopwatch /> {/* New utilization */}
<Component {...pageProps} />
</QueryClientProvider>
</ThemeProvider>
);
};

export default MyApp;