Pages
Introduction
Getting Started
Recipes
Reference
Literals
Arrays
Tuples
Type System
Functions
Modules
Records
Enums
Built-in Types
Constants
Equality
Stores
Routing
Comments
Control Expressions
Components
Properties
Computed Properties
Styling Elements
Connecting Stores
Using Providers
Internal State
Referencing Entities
Global Components
Lifecycle Functions
Directives
JavaScript Interop
Environment Variables
Packages
Computed Properties
Computed properties are functions that work like properties, they are defined with the
get
keyword and no arguments.
component Greeter {
property name : String = ""
get text : String {
"Hello " + name + "!"
}
fun render : Html {
<div>
<{ text }>
</div>
}
}
Optional type
The type annotation is optional:
component Greeter {
property name : String
get text {
"Hello " + name + "!"
}
fun render {
<div>
<{ text }>
</div>
}
}