useInlineTrigger
Stable · since 0.1.0
Defines a trigger inline inside a component. The trigger is created on mount, lives until unmount, and is automatically disposed when the component unmounts. Use this for one-off reactions where pulling them into a separate *.trigger.ts file would be overkill — tiny analytics taps, modal-stack coordination scoped to one screen, keyboard shortcuts that only matter while a panel is open.
For anything reusable across the app — prefer createTrigger in a dedicated *.trigger.ts file.
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Param | Type | Required | Description |
|---|---|---|---|
config.on | keyof S['events'] | yes | Event name to react to. Must be stable between renders. |
config.do | TriggerHandler<S> | yes | Handler body. Receives the same ctx as a full createTrigger handler. |
config.id | string | no | Optional debug id. Defaults to an auto-generated stable id (inline:<n>). |
Returns
Section titled “Returns”void. The trigger is registered in useEffect and disposed on unmount.
Examples
Section titled “Examples”Analytics tap scoped to one screen
Section titled “Analytics tap scoped to one screen”Keyboard shortcut while a panel is open
Section titled “Keyboard shortcut while a panel is open”Pinned id for tests
Section titled “Pinned id for tests”Reading conditions / firing actions
Section titled “Reading conditions / firing actions”Related
Section titled “Related” createTrigger The full constructor — preferred for reusable triggers.
useEvent Fire the event your inline trigger reacts to.
TriggerScope Scope inline triggers to a subtree.
When to inline guide One-off reactions vs file-level triggers.