Skip to content

能不能把useTimeout升级一下? #2537

Open
@npmstudy

Description

@npmstudy

用法示意

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和测试提上来。

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions