import React, { useState } from 'react'; import { useInterval } from 'yhooks'; import { Button } from 'antd'; export default () => { const [count, setCount] = useState(0); const [delay, setDelay] = useState(1000); useInterval(() => { setCount(count + 1); }, delay, { immediate: true },); return ( <>
count: {count}
); };