Intro to Variables
Variables allow you to store and use pieces of data in your app
Variable Types
There are four types of variables available that you can use inside a Draftbit app.
Variable Type | Description |
---|---|
Variables that can be set and used throughout your entire application. Each time your app restarts, this type of variable will reset to its default value. Useful for storing constants as a default value or other app-wide, non-user-specific, data such as an | |
Variables that allow you to store data on your app users' devices that can be used throughout your app. Each time your app restarts, this type of variable will not reset to the default value and will use the last value stored in it. Useful for storing user-specific data that needs to persist across sessions, such as an | |
Variables that are scoped to the Screen on which they are created. Each time the app restarts or the Screen is removed from the navigation stack, this value will be reset to its default value. Useful for storing Screen-specific data, such as variables associated with various input components for a form. | |
System-generated variables that come with a pre-defined value such as Is Online, Is iOS, and Device Width. |
Creating a Variable
To create variables, open the Variables modal from the left menu bar of the Builder
JSON Data Format
All variables available in Draftbit can be assigned valid JSON data. You can use this free service to make sure your value is valid JSON.
Data Type | Examples |
---|---|
String |
|
Number |
|
Boolean |
|
Object |
|
Array |
|
Updated about 1 month ago
Learn about the different types of variables available to you