mirror of
https://github.com/sveltejs/svelte.git
synced 2024-11-21 19:38:58 +01:00
docs: Reference svelte/reactivity
from $state
. (#13571)
This commit is contained in:
parent
6257203c22
commit
69f6b58bd4
@ -20,6 +20,8 @@ Unlike other frameworks you may have encountered, there is no API for interactin
|
|||||||
|
|
||||||
If `$state` is used with an array or a simple object, the result is a deeply reactive _state proxy_. [Proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) allow Svelte to run code when you read or write properties, including via methods like `array.push(...)`, triggering granular updates.
|
If `$state` is used with an array or a simple object, the result is a deeply reactive _state proxy_. [Proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) allow Svelte to run code when you read or write properties, including via methods like `array.push(...)`, triggering granular updates.
|
||||||
|
|
||||||
|
> [!NOTE] Classes like `Set` and `Map` will not be proxied, but Svelte provides reactive implementations for various built-ins like these that can be imported from [`svelte/reactivity`](./svelte-reactivity).
|
||||||
|
|
||||||
State is proxified recursively until Svelte finds something other than an array or simple object. In a case like this...
|
State is proxified recursively until Svelte finds something other than an array or simple object. In a case like this...
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
Loading…
Reference in New Issue
Block a user