BaseTen provides a mutable key-value store that creators can use to create stateful application. This can be used for sharing values between components, or for keeping track of temporary variables as users interact with views.

Initializing state fields

State fields can be added in the data sources menu. Simply name the field, and give it a default value. Alternatively, if the field is set somewhere in the view, it will automatically be initialized.

Referencing state fields

When configuring components with the “Function” option, all the available state fields are nested underneath the state attribute.

Modifying state fields

State fields can be modified using simple JavaScript. As an example, if you want to set a state field based on the click of a button, simply choose “Set Field” as the action, choose the field name, and write the code snippet that will be evaluated to set the referenced field.
Last modified 7mo ago
Copy link