mirror of
https://github.com/zhigang1992/react.git
synced 2026-01-30 17:18:35 +08:00
fix(use-portal): don't remove shared element slot when component destroyed
This commit is contained in:
@@ -21,13 +21,6 @@ const usePortal = (selectId: string = getId()): HTMLElement | null => {
|
||||
document.body.appendChild(el)
|
||||
}
|
||||
setElSnapshot(el)
|
||||
|
||||
return () => {
|
||||
const node = document.getElementById(id)
|
||||
if (node) {
|
||||
document.body.removeChild(node)
|
||||
}
|
||||
}
|
||||
}, [])
|
||||
|
||||
return elSnapshot
|
||||
|
||||
Reference in New Issue
Block a user