Skip to content

Commit

Permalink
docs: update micro-module.md (#735)
Browse files Browse the repository at this point in the history
先暂存微模块挂载的dom节点,再传递给 ummoutModule,原先写法在 useEffect return 中,renderNode.current 已经是 null 了
  • Loading branch information
lxzy-yun authored Apr 11, 2024
1 parent f67f6fd commit 9592ca9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions website/docs/guide/micro-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<div ref={renderNode}></div>);
Expand Down

0 comments on commit 9592ca9

Please sign in to comment.