When you click on a sentence, you will usually see a big text box that takes more information from you wherever necessary. It looks as below:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/35c0f4ab-0f35-409d-b92b-2db6e204a533/Screenshot_2020-11-01_at_9.37.06_AM.png

Here is how you write expressions:

  1. This is a fully-featured JavaScript box. You can write any valid Javascript expression here.
  2. You will see the output that comes from your expression evaluation right below your expression code.
  3. You can refer to any of the application data (all of the components, data sources, variables, API responses) in this textarea. Try typing appData to get suggestions on the things you can use.
  4. The entire appData is also visible on the right side when you click on any sentence. You can explore all the data at any time.
  5. Every expression box needs to return some data. If you write a one line expressions, we automatically add a return statement. If you write a multi-line expression, you will have to add a return statement to correctly return data from the expression box.
  6. Forms have their data stored in the value key.
  7. While describing the configuration for a list, you can use currentItem key from the list data to refer to the ith item of the list. You can read more about how to describe lists here.
  8. For a list, you can use clickedItem to get the data of the item that was clicked in a list. You can use this data to render appropriate data in the next pages.
  9. When you call an API, we automatically create an appData variable corresponding to the API call with the keys loading, ok and body. The loading will be true while the API is in pending state, the ok key will be true if the API call was successful and the body key will contain the response of the API.
  10. The expression you write is evaluated with respect to the appData that exists at that point in time. This means that an expression which throws an error at one point might return data correctly at some other point when the data it depends on is well-defined. So make sure you check the application state if your expression is not working correctly.