-
Couldn't load subscription status.
- Fork 49.7k
Closed
Closed
Copy link
Description
React version: experimental
Steps To Reproduce
- Set up a React project with
react@experimental&react-dom@experimentalwhich includes custom element property support. - Render a custom element with a property value provided as prop, then on a re-render remove that prop.
e.g.
function App() {
const [condition, setCondition] = useState(false);
return (
<>
<button onClick={() => setCondition(c => !c)}>toggle</button>
{condition ? <my-element foo={"foo"} /> : <my-element />}
</>
);
}Link to code example:
https://stackblitz.com/edit/vitejs-vite-dz2rka?file=src%2FApp.tsx
The current behavior
The value of the foo property on <my-element> will start off undefined. Toggling condition to true will set the property to "foo", but subsequently toggling condition back to false will set the property to null.
The expected behavior
I would expect the property to be undefined.
justinfagnani and thescientist13