Functions
Functions define a block of code or component that can be reused.
Reactive.Function("Greeting", () => {
const person = Reactive.Argument(People.Person); // a typed value in
Layout.Row(() => {
Content.Text("Hello, ");
Content.Text(person.name);
});
});Defining a function
Call Reactive.Function with a name and a body, as above. Declare each input the body takes with
Reactive.Argument, then build the output by calling other functions.
Using a function
A defined function is installed under its name, so you call it and pass its arguments the same way you call any built-in operation.
Layout.Column(() => {
Reactive.Greeting(ada); // call it by name, passing the record
});