S
SolidJS4mo ago
Paul

Compound component find Type?

Imagine I have the following:
<Stepper>
<Stepper.Step>
</Stepper.Step>
<Stepper.Completed>
</Stepper.Completed>
</Stepper>
<Stepper>
<Stepper.Step>
</Stepper.Step>
<Stepper.Completed>
</Stepper.Completed>
</Stepper>
Is there a way in solid to find whether a child component is Step or Completed? I appreciate there is no vdom. But surely solid goes through the JSX itself? Does it retain the .Step/Completed type? I don't know the name for this. Using children() I can only retrieve the rendered outcome of the children. Thanks!
3 Replies
Brendonovich
Brendonovich4mo ago
No, this is a limitiation of typescript's JSX support Ah at runtime it's also not really possible unless you return special objects as children - with Solid you can kinda lie and return non-JSX values from components
Paul
PaulOP4mo ago
I figured as much, but I wanted to confirm. Thanks for the reply. Appreciate it!
bigmistqke
bigmistqke4mo ago
For an example of the latter: see how solid implements Switch/Match components.

Did you find this page helpful?