react hook 如何在组件卸载时做出动作

漫思 / 2023-08-07 / 原文

   useEffect(() => {
        return () => {
            closeWebSocket();
        }
    }, [])