Replacing specific HTML elements with Solid Components
Hey. I have a string with html markup, I want to replace some specific elements (based on some attributes) with a Component. How can I achieve this?
For example,
const htmlMarkupString = '<div><span id="replaceMe"></span></div>'
I want the span with id replaceMe to be replaced with a Solid Component
Can anyone please help me with this?
1 Reply
I don't think there is a specific api for this
this is what I came up with: https://playground.solidjs.com/anonymous/99e87332-8cbe-443e-9f58-39c7562304a4
it might be bad or fine depending on if you use ssr, how much do you want to replace, etc
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template