The value to observe for changes.
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
- onAppear — runs an action on first appearance
- onDisappear — runs an action on removal