Variables
Creating variables
You cannot specify the initial value of a variable based on data from an API since the value data from the API will not be ready at the time the variable is initialized. Instead set an initial value such as Null and the update the variable when the data is fetched from the API.
Updating variables
Updating variables
Variable scope
Initially this may seem rather limiting, but as your application grows and your are adding more and more components, it drastically simplifies reasoning about your applications data. Without this restraint in can sometimes be difficult to know which parts of our application is using a specific variable, or if it is even still relevant.
Binding input fields
Binding an input to a variable is just a shortcut for: 1. Setting the inputs value attribute to match the variable. 2. Updating the variable when an input event happens on the input. To understand how this works, inspect the value attribute and input event of an input after you have bound it to a variable.