attr.maybe
should offer similar API to attr
#89
Labels
enhancement
ergonomics
need to find time
https://falseknees.com/297.html
needs design
The solution is not clear, or I am not very happy with it
Currently only
attr.maybe(someValue)
is possible, but notattr.maybe := someValue
orattr.maybe <-- $someValue
. We could implement these with some work.The main problem is, we don't know the default value of each attr / prop / css key.
But...
false
and""
will work for those specific props.Main complication is that ReflectedAttrs currently uses the Props class from SDT which doesn't carry any info about the corresponding attribute name. But SDT itself does provide this information. So we will probably need a custom Props class in Laminar for this.
We could also potentially use the property's current value (at the time the maybe modifier is added) as its default value, but I could see this being confusing if the user has previously set some value to this property. But actually, if we don't do this, the behaviour of
attr.maybe(someValue)
andattr.maybe <-- Val(someValue)
would be different. Hm...The text was updated successfully, but these errors were encountered: