📌  相关文章
📜  useeffect clearinterval loading - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:32.157000             🧑  作者: Mango

代码示例1
const Loading = () => {
  const [loadingStatus, setLoadingStatus] = useState(".");

  useEffect(() => {
    const intervalId = setInterval(() => {
      setLoadingStatus(ls => ls + ".");
    }, 1000);

    return () => clearInterval(intervalId);
  }, []);

  return 

{`Loading ${loadingStatus}`}

; };