jamilharun / LAB1-FINALS

0 stars 0 forks source link

Use effect undefined #7

Open jamilharun opened 7 months ago

jamilharun commented 7 months ago

new

App.jsx

import { useEffect, useState } from 'react'

useEffect(() => {
    setTimeout(() => {
      setCount((count) => count + 1);
    }, 1000);
});
<div className=' flex justify-center text-center'>
          <button onClick={() => setCount((count) => count + 1)}>
            plus
          </button>
          <p className="read-the-doc">count is {count}</p>
          <button onClick={() => setCount((count) => count - 0)}>
            reset
          </button>
</div>