I have too long Switch, Match
Is there any alternative in this case?
I have 50 components to match..
![](https://utfs.io/f/cf2b2d32-035a-4600-ad4f-66db16f600bf-1nq2cb.png)
6 Replies
if the it's just integers then maybe an array?
like
elements[value]()
I thought same solution, but it doesn't work. re-render when changing singnal..
![](https://utfs.io/f/2ba6f284-371b-458b-8d28-6d424eecb353-1nq2cb.png)
https://www.solidjs.com/tutorial/flow_dynamic maybe this helps?
SolidJS
Solid is a purely reactive library. It was designed from the ground up with a reactive core. It's influenced by reactive principles developed by previous libraries.
Thanks delu. Yes, it works really well. I should use MyComponent, instead <MyComponent /> to use inside options..:)
Glad I could help 🙂
Potentially you can also just have a single createMemo and put the logic in there 🤔