StableAction
Increase / decrease state
Overview
Adds a number to a state value — a counter, a quantity, the current step of a wizard.
Purpose
Use it for “+ / −” quantity buttons, “Next step” / “Previous step”, or counting how many times something happened during a visit.
Inputs
- State, Component and Key — as for Set state.
- By — the amount to add. Use a negative number (for example
-1) to decrease.
Configuration
- If the key has no numeric value yet, it is treated as 0. Combine with If / else to stop at a minimum or maximum.
Outputs
- None directly; the updated number is available as the same state key.
Example
Quantity picker
Example
Button “+” › On click: Increase / decrease state App state › qty By: 1 Button “−” › On click: If App state › qty > 1 → Increase / decrease state App state › qty By: -1
Errors
- None.
Limitations
- Works with numbers only; text that is not numeric counts as 0.
Advanced
- Schema:
{ type: "increment_state", scope, key, componentId?, by: number }.next = (Number(current) || 0) + by.