You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/business-logic-in-apps/write-javascript/temporary-state.md
+4-16Lines changed: 4 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -79,22 +79,10 @@ state2.setIn([1],"foo") // this will result to ["hello", "foo"]
79
79
80
80
You can also call these two methods in event handlers. Select **Set temporary state** as the action and choose method on demand.
81
81
82
-
## Example: Increment counter
82
+
## Example: Multiple Steps Job application app
83
83
84
-
In this example, the counter tracks the number of button clicks. Every time the user clicks the button, the number in the text component increases by one.
84
+
In this example, we are building an app via which an Applicant can apply for a job by going via different steps. We will use Temporary state variable to store data on each step, and will show all the data on the final step from Temporary state variable.
85
85
86
-
Build an increment counter in following steps:
86
+
The following demo shows all the steps of creating this app, and explains in detail the usage of Temporary state : 
87
87
88
-
1. Add a button component `button1` and a text component `text1`.
89
-
2. Create a temporary state `state1`, set its initial value as `0`. Bind `{{state1.value}}` as the display text of `text1`.
90
-
3. Add an event handler for `button1`. Select the action **Set temporary state** and the method **setValue**, and then set `{{state1.value+1}}` as the value.
91
-
4. Click the button, you can see the value of `text1` increases by one each time you click.
92
-
93
-
You can also achieve the same result using JavaScript queries:
94
-
95
-
1. Add a new query, select **Run JavaScript code**.
96
-
2. Write JavaScript query with this code, and set it to be manually invoked:\
97
-
`state1.setValue(state1.value + 1)`
98
-
3. Add an event handler of `button1` to run `query1`.
99
-
100
-
Now click the **Increment counter** button, you should see the same result as above.
Copy file name to clipboardExpand all lines: docs/business-logic-in-apps/write-javascript/transformers.md
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -63,3 +63,11 @@ Instead, calling the method `setText()` in a JavaScript query reports no error.
63
63
In another example, transformer`sort1` aims at sorting the data of `getUsers` by `first_name`, but the `sort()` method may change the original data, so an error occurs.
64
64
65
65
In this case, use the method `_.orderBy()` provided by [lodash](https://lodash.com/) instead.
66
+
67
+
## Example: Calculating Average via Transformers
68
+
69
+
In this example, we are building an app via which an Applicant can apply for a job by going via different steps. We will use Temporary state variable to store data on each step, and will show all the data on the final step from Temporary state variable.
70
+
71
+
The following demo shows all the steps of creating this app, and explains in detail the usage of Temporary state : 
0 commit comments