Rendering issue

When trying to render the same JSX stored in state to the screen twice at the same time. It only renders one of the JSX elements. The JSX is passed as props to the component and is stored in an accessor function returned from the createReducer primitive. I am doing something wrong?
6 Replies
thetarnav
thetarnav2y ago
"one of the jsx" What does that mean? JSX gets compiled to an expression creating real dom nodes once executed. Are you trying to render the same html element in two places at once? You probably need to wrap it in a thunk so that it is executed lazily, producing different html elements
JonathanExcelsior
I meant one out of the two JSX elements. Yes, I am trying to do that. I will give that a go. Thanks! Or I was thinking making an copy of the piece of state as it's an array of JSX elements generated using <For> element.
thetarnav
thetarnav2y ago
probably better to share some code so we are on the same page
thetarnav
thetarnav2y ago
Here is an old issue that sounds similar: https://github.com/solidjs/solid/issues/899
GitHub
Not able to create duplicate Elements · Issue #899 · solidjs/solid
Describe the bug Hi 👋 Thanks for creating this Library. I am using solid for my recent project and I needed to create duplicate elements for a use case. I created a JSX variable and using loop I tr...
JonathanExcelsior
Yes, this is what I was experiencing. Thanks for that! solid I did find a workaround but is not elegant. I'll keep trying!
ryansolid
ryansolid2y ago
Yeah this is how the DOM works