A small discussion with community. After bit of di...
# compose-web
u
A small discussion with community. After bit of discussion we've decided to get rid of following API method:
Copy code
classes {
   +"a"
   +"b"
}
and suggest everyone to use just classes("a", "b"). Since previous release this method behaves cumulative and there are no cases that can be covered with "regular" API call compared to the builder counterpart. If you know such cases or think that the builder version is still preferable in some cases - let's discuss. We are not making any promises but it would be very helpful at least to take into consideration any points we've missed. Speak now or never )
๐Ÿ‘๐Ÿป 1
๐Ÿ†— 3
๐Ÿ‘ 8
b
Would also be good to get classesFromString() or something that'd allow us to declare all classes via single string (like in html) to make converting components from other frameworks easier.
u
Well personally me like the idea of keeping the core API as small as possible. What you are describing is easily achievable but not necessarily should be in the framework itself. But good point actually, thank you for letting know - we'll discuss this as well.
b
Might be worth spinning up composex package to shove things like that then?
l
compo sex? ๐Ÿ™ˆ
๐Ÿ˜„ 4
b
Also, I think it's important to be able to remove a class from component as well.
Not sure if it's possible already
l
What are your use cases?
b
Styling mainly. Think of colouring a button to represent on/off states
l
It's just an if?
If the condition changes, recomposition triggers, and if the different code path doesn't set the classes, they are gone.
b
Ah, you're right!
u
@Big Chungus we've tried to come up with scenario where one is removing class but failed to invent one. If there's a real-life example we can discuss - sure, let's discuss. But I'm with @louiscad on that )
๐Ÿ‘ 1