Setters
Every base var has a built-in event handler to set it's value for convenience, called set_VARNAME
.
Say you wanted to change the value of the select component. You could write your own event handler to do this:
1
Or you could could use a built-in setter for conciseness.
1
In this example, the setter for selected
is set_selected
. Both of these examples are equivalent.
Setters are a great way to make your code more concise. But if you want to do something more complicated, you can always write your own function in the state.