From 9592ca9e71bdd919b13b9089e3f0b2ee41081d72 Mon Sep 17 00:00:00 2001 From: lxzy-yun <924305751@qq.com> Date: Thu, 11 Apr 2024 17:46:47 +0800 Subject: [PATCH] docs: update micro-module.md (#735) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 先暂存微模块挂载的dom节点,再传递给 ummoutModule,原先写法在 useEffect return 中,renderNode.current 已经是 null 了 --- website/docs/guide/micro-module.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/website/docs/guide/micro-module.md b/website/docs/guide/micro-module.md index 484329af..ff7455d5 100644 --- a/website/docs/guide/micro-module.md +++ b/website/docs/guide/micro-module.md @@ -282,9 +282,10 @@ const moduleInfo = { const ModuleComponent = () => { const renderNode = useRef(null); useEffect(() => { - mountModule(moduleInfo, renderNode.current, {}); + const dom = renderNode.current; + mountModule(moduleInfo, dom, {}); return () => { - unmoutModule(moduleInfo, renderNode.current); + unmoutModule(moduleInfo, dom); } }, []); return (
);