shade icon indicating copy to clipboard operation
shade copied to clipboard

Sharp corner: Attribute state in tag subcomponents

Open ScottPeterJohnson opened this issue 4 years ago • 0 comments

E.g.:

var foo by observable(false)
button {
    classes = setOf("foo")
    render {
        if(foo){
            classes = classes + "bar"
        }
    }
    onClick { foo = true }
}

Since enclosing tags are synthetically created fresh on component re-render, the button's classes would end up as just "bar" after the button's click. We may be able to warn users when they access attribute values of a tag.

ScottPeterJohnson avatar Dec 02 '21 10:12 ScottPeterJohnson