Open
Description
Describe the bug
Let's say I have a basic React component:
const Test = (props) => {
return (
<div {...props}>{props.children}</div>
);
};
And then I use sx
on that component, swapping between an object and undefined
based on some state:
<Test sx={someBoolean ? myStyles : undefined}/>
This causes the Test
component to unmount/remount (along with any children it renders).
This is because when the sx
prop is defined, Test
is rendered inside EmotionCssPropInternal
and when it's undefined, it's rendered on its own.
I don't believe this is the case when using emotion's css
prop.
Expected behavior
EmotionCssPropInternal
should wrap any component that uses sx
prop, even if that prop value is undefined
.