Skip to content

Commit 9592ca9

Browse files
authored
docs: update micro-module.md (#735)
先暂存微模块挂载的dom节点,再传递给 ummoutModule,原先写法在 useEffect return 中,renderNode.current 已经是 null 了
1 parent f67f6fd commit 9592ca9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

website/docs/guide/micro-module.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,10 @@ const moduleInfo = {
282282
const ModuleComponent = () => {
283283
const renderNode = useRef(null);
284284
useEffect(() => {
285-
mountModule(moduleInfo, renderNode.current, {});
285+
const dom = renderNode.current;
286+
mountModule(moduleInfo, dom, {});
286287
return () => {
287-
unmoutModule(moduleInfo, renderNode.current);
288+
unmoutModule(moduleInfo, dom);
288289
}
289290
}, []);
290291
return (<div ref={renderNode}></div>);

0 commit comments

Comments
 (0)