Skip to content

Commit 52661d0

Browse files
author
wangcuijuan
committed
修正记忆化回调中更新 state写法
1 parent a0b341b commit 52661d0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/webpack-plugin/lib/runtime/components/react/mpx-portal/portal-manager.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const _PortalManager = forwardRef((props: PortalManagerProps, ref:ForwardedRef<u
1919
setState((prevState) => ({
2020
portals: [...prevState.portals, { key, children }]
2121
}))
22-
}, [state])
22+
}, [])
2323

2424
const update = useCallback((key: number, children: ReactNode) => {
2525
setState((prevState) => ({
@@ -30,7 +30,7 @@ const _PortalManager = forwardRef((props: PortalManagerProps, ref:ForwardedRef<u
3030
return item
3131
})
3232
}))
33-
}, [state])
33+
}, [])
3434

3535
const unmount = useCallback((key: number) => {
3636
setState((prevState) => ({

0 commit comments

Comments
 (0)