import { useEffect, useState } from 'react' function Test () { useEffect(() => { let timer = setInterval(() => { console.log('定时器执行了') }, 1000) return () => { // 清理定时器 clearInterval(timer) } }, []) return (