Skip to main content
V
required
The value to observe for changes.
(values: [V, V]) => void
required
A callback that receives a tuple of [oldValue, newValue] 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 old and new values as a tuple [oldValue, newValue], allowing comparison logic. On iOS and Android, both values arrive as strings. On Android, the action is called as (oldValue, newValue), so a handler that destructures a tuple gets the wrong values there.

See Also