Countdown
小于 1 分钟
const { useState, useEffect } = React;
const App = (props) => {
const [count, setCount] = useState(100);
useEffect(() => {
setInterval(() => {
setCount(count - 1);
}, 1000);
}, [count]);
return (
<div>
<h1>{props.title}</h1>
<div>{count}</div>
<div>
<button>开始</button>
<button>结束</button>
<button>暂停</button>
</div>
</div>
);