import { useState, useEffect } from "react";


function UseEffectTest() {
    let [counter, setCounter] = useState(0)


    useEffect(() => {
        let timer = setTimeout(() => {
            setCounter((counter) => counter + 1)
        }, 3000)


        return () => clearTimeout(timer)
    }, [counter])


    return <h1>A counter értéke {counter}</h1>
}


export default UseEffectTest