What's the simplest way to combine the classList prop?

I have a component that takes a classList prop, and I want to combine it with a reactive classList object of its own before setting it on an internal element. What's the easiest way to do that while keeping the prop and the internal object reactive?
2 Replies
thetarnav
thetarnav2y ago
if you spread both in the prop, it should be reactive classList={{ ...props.classList, sthElse: isEnabled() }} you can also use combineProps to combine multiple props at once: https://github.com/solidjs-community/solid-primitives/tree/main/packages/props#combineprops
Wurfle
Wurfle2y ago
Wouldn't spreading the props break the individual add/remove class? or does it diff the object?
Want results from more Discord servers?
Add your server
More Posts