JSXElement in createSignal or createMemo, when the page changes, it disappears on the page. #1981
-
Describe the bugI am writing a select component, but when I set the label to be a JSXElement, the JSXElement in the label disappears when the select component is clicked. Or am I using it incorrectly? Developers are hoped to see this, and solid is very nice! thank you very much. Your Example Website or Apphttps://stackblitz.com/edit/solidjs-templates-qhnsfh?file=src%2FApp.tsx Steps to Reproduce the Bug or Issue
Expected behaviorThe label not disappear. Screenshots or VideosNo response Platform
Additional contextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
So what happens when you do That means that every time that value is used it's the same element. Some constrains apply to elements regarding to the DOM, like this one that I think is what you're running into:
What solid usually does to work around this, is not evaluating Fixed example: https://stackblitz.com/edit/solidjs-templates-mvvvev?file=src%2FApp.tsx |
Beta Was this translation helpful? Give feedback.
So what happens when you do
<b>test</b>
is that it will actually evaluate to a HTMLElement (the same as callingdocument.createElement("b")
).That means that every time that value is used it's the same element. Some constrains apply to elements regarding to the DOM, like this one that I think is what you're running into:
What solid usually does to work around this, is not evaluating
<b />
at the time of creation of the object that should contain it, but first when it's needed, using a getter. That way you insert the value on your object multiple times into the DOM b…