Update documentation/docs/02-runes/02-$state.md

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
reactivity-boundary-docs
Simon H 10 months ago committed by GitHub
parent 11dbd6a0af
commit f928779665
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -139,7 +139,7 @@ This can improve performance with large arrays and objects that you weren't plan
## Passing `$state` across boundaries
Since there's no wrapper around `$state` or `$state.raw` (or [`$derived`]($derived)), you have to be aware of keeping reactivity alive when passing it across boundaries, e.g. when you pass a reactive object into or out of a function. The most succinct way of thinking about this is to treat `$state` and `$state.raw` (and [`$derived`]($derived)) as "just JavaScript", and reuse the knowledge of how normal JavaScript variables work when crossing boundaries. Take the following example:
Since there's no wrapper around `$state`, `$state.raw`, or [`$derived`]($derived), you have to be aware of keeping reactivity alive when passing it across boundaries — e.g. when you pass a reactive object into or out of a function. The most succinct way of thinking about this is to treat `$state`, `$state.raw`, and [`$derived`]($derived) as "just JavaScript", and reuse the knowledge of how normal JavaScript variables work when crossing boundaries. Take the following example:
```js
// @errors: 7006

Loading…
Cancel
Save