Conditional Component Type rendering?
I am trying to work on a component where depending on a variable I need to wrap it with either an
<a> tag or a <div>.
The only conditional flow related documentation uses the <Show> component, but I'm trying to do something more akin to
I'm pretty sure something like the following would work, but how do I do this with basic HTML elements?
thanks!2 Replies
You can use
Dynamic.
<Dynamic component={props.aTag ? 'a' : 'div'} children={props.children} />
https://www.solidjs.com/docs/latest/api#dynamicexcellent thank you!