Commit 59755016 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复组件销毁还更新state的问题

parent cf0630bf
......@@ -75,7 +75,7 @@ const AnchorPage = (props: IProps) => {
useEffect(() => {
const firstKey = anchors.length ? `#${anchors[0].key}` : '';
if (firstKey && firstKey !== current) {
setCurrent(firstKey);
mounted.current && setCurrent(firstKey);
}
}, [anchors]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment