diff --git a/src/Portal.tsx b/src/Portal.tsx index 3678b74..a04905a 100644 --- a/src/Portal.tsx +++ b/src/Portal.tsx @@ -91,7 +91,12 @@ const Portal = React.forwardRef((props, ref) => { const customizeContainer = getPortalContainer(getContainer); // Tell component that we check this in effect which is safe to be `null` - setInnerContainer(customizeContainer ?? null); + setInnerContainer( + () => + // React do the state update even the value is the same, + // Use function call to force React to compare update + customizeContainer ?? null, + ); }); const [defaultContainer, queueCreate] = useDom(