Variables and Parameters
In How Data Flows, variables and parameters are runtime memory. The database is long-term storage.
| Variables | Parameters | |
|---|---|---|
| Purpose | Store state | Pass data across boundaries |
| Focus | Lifecycle and scope | Input/output contract |
Variables
Client variable
- Scope: All pages in the current client session
- Lifecycle: App session — reset on close or refresh (Web)
- Examples: global config, cached logged-in account, cross-page cart draft
Page variable
- Scope: Current page only
- Lifecycle: Created on enter, destroyed on leave
- Examples: form staging, modal visibility, in-page search keyword
Actionflow variable
- Scope: Current Actionflow run only
- Lifecycle: Initialized at start, destroyed when the flow ends
- Examples: loop totals, API payload staging
Parameters
Route and page parameters
- Path parameters: part of the route (
/product/:id) — structured, required, SEO-friendly - Query parameters:
?source=qr&page=2— optional, tracking, filters
💡
URL example: https://momen.app/article/content/how-to-build-an-ai-bot?utm_source=google
- Path:
/article/content/how-to-build-an-ai-bot— path segment identifies the article - Query:
?utm_source=google— channel tracking, does not change core route
Custom component parameters
- Inputs: parent → child (image, price into a card component)
- Outputs: child → parent (e.g. product ID on “Add to cart”)
Logic parameters (Actionflow, API, AI)
- Input parameters: data the caller must supply (order ID, prompt text)
- Output parameters: results returned to the caller (total price, generated text, status code)
Selection matrix
| Scenario | Use | Why |
|---|---|---|
| Persist logged-in identity app-wide | Client variable | Global reuse |
| Toggle modal on current page | Page variable | Auto-destroy on leave |
| Accumulate values inside a flow | Actionflow variable | Backend-local; don’t pollute page state |
| Open product detail | Path parameter | Clean URL, SEO |
| Track QR campaign source | Query parameter | Append without changing route |
| Call API, AI, or Actionflow | Input parameter | Strong cross-boundary contract |
| Refresh UI from backend result | Output parameter | Capture black-box output |
Related Reading
- Query and Bind Data — use variables and parameters in queries and bindings
- How Data Flows — where variables fit in the data pipeline
Last updated on