Skip to content

Commit

Permalink
Update watch.md (#3621)
Browse files Browse the repository at this point in the history
  • Loading branch information
diomed authored Jul 24, 2023
1 parent 9e0f391 commit 3cb07a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/docs/src/en/magics/watch.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ When the `<button>` is pressed, `foo.bar` will be set to "bob", and "bob" will b
<a name="deep-watching"></a>
### Deep watching

`$watch` will automatically watches from changes at any level but you should keep in mind that, when a change is detected, the watcher will return the value of the observed property, not the value of the subproperty that has changed.
`$watch` automatically watches from changes at any level but you should keep in mind that, when a change is detected, the watcher will return the value of the observed property, not the value of the subproperty that has changed.

```alpine
<div x-data="{ foo: { bar: 'baz' }}" x-init="$watch('foo', (value, oldValue) => console.log(value, oldValue))">
Expand Down

0 comments on commit 3cb07a9

Please sign in to comment.