import React, { useState, useEffect } from 'react'
import styles from './index.module.scss'

const Timer = () => {
    const [seconds, setSeconds] = useState(0);
    useEffect(() => {
        const interval = setInterval(() => {
            setSeconds(prev => prev + 1);
        }, 1000);
        return () => {
            clearInterval(interval);
        };
    }, []);
    return (
        <div>
            <h2>Прошло секунд: {seconds}</h2>
        </div>
    );
}

export default Timer