Skip to main content
value
V
required
The value to observe for changes.
action
(values: [V, V]) => void
required
A callback that receives a tuple of [newValue, oldValue] when the watched value changes.

Support

Usage

Watching a state value

Reacting to selection changes

Triggering side effects

Notes

  • The action only fires when the value actually changes, not on initial render. Use .onAppear() for initial setup.
  • The callback receives both the new and old values as a tuple [newValue, oldValue], allowing comparison logic.

See Also