Open
Description
用法示意
import { useTimeout } from 'ahooks/useTimeout';
export default () => {
const [counter, setCounter] = useState(0)
const [start, clear, isActive] = useTimeout(() => setCounter(counter + 1), 0, false);
return (
<div className="App" onClick={() => start()}>
<h1 style={{border:'1px dashed'}}>点击开启定时器 {counter}</h1>
</div>
);
};
如果需要,我把pr和测试提上来。