Skip to content

Commit d0bd349

Browse files
committed
update to signals section
1 parent bb3469c commit d0bd349

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/guide/extras/reactivity-in-depth.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,18 +413,22 @@ export function useMachine(options) {
413413

414414
## Connection to Signals
415415

416-
Quite a few other frameworks have introduced reactivity primitives similar to Vue refs, under the term "signals":
416+
Quite a few other frameworks have introduced reactivity primitives similar to refs from Vue's Composition API, under the term "signals":
417417

418418
- [Solid Signals](https://www.solidjs.com/docs/latest/api#createsignal)
419419
- [Angular Signals](https://github.com/angular/angular/discussions/49090)
420420
- [Preact Signals](https://preactjs.com/guide/v10/signals/)
421421
- [Qwik Signals](https://qwik.builder.io/docs/components/state/#usesignal)
422422

423-
Fundamentally, signals are the same kind of reactivity primitive as Vue refs. It's a value container that provides dependency tracking on access and effect trigger on mutation. In some contexts, signals are also related to the rendering model where updates are performed through fine-grained subscriptions, although it is not a necessary trait for something to be called signals.
423+
Fundamentally, signals are the same kind of reactivity primitive as Vue refs. It's a value container that provides dependency tracking on access, and side-effect triggering on mutation. This reactivity-primitive-based paradigm isn't a particularly new concept in the frontend world: it dates back to implementations like [Knockout observables](https://knockoutjs.com/documentation/observables.html) and [Meteor Tracker](https://docs.meteor.com/api/tracker.html) from more than a decade ago. Vue Options API the React state management library [MobX](https://mobx.js.org/) are also based on the same principles, but hide the primitives behind object properties.
424424

425-
Among these implementations, the design of Preact and Qwik's signals are very similar to Vue's [shallowRef](/api/reactivity-advanced.html#shallowref): all three provide a mutable interface via the `.value` property.
425+
Although not a necessary trait for something to qualify as signals, today the concept is often discussed alongside the rendering model where updates are performed through fine-grained subscriptions. Due to the use of Virtual DOM, Vue currently [relies on compilers to achieve similar optimizations](https://vuejs.org/guide/extras/rendering-mechanism.html#compiler-informed-virtual-dom). However, we are also exploring a new Solid-inspired compilation strategy (Vapor Mode) that does not rely on Virtual DOM and takes more advantage of Vue's built-in reactivity system.
426426

427-
### Solid Signals
427+
### API Design Trade-Offs
428+
429+
The design of Preact and Qwik's signals are very similar to Vue's [shallowRef](/api/reactivity-advanced.html#shallowref): all three provide a mutable interface via the `.value` property. We will focus the discussion on Solid and Angular signals.
430+
431+
#### Solid Signals
428432

429433
Solid's `useSignal()` API design emphasizes read / write segregation. Signals are exposed as a read-only getter and a separate setter:
430434

@@ -453,7 +457,7 @@ export function createSignal(value, options) {
453457
454458
[Try it in the Playground](https://sfc.vuejs.org/#eNp9UsFu2zAM/RVCl9iYY63XwE437A+2Y9WD69KOOlvSKNndEPjfR8lOsnZAbxTfIx/Jp7P46lw5TygOovItaRfAY5jcURk9OksBztASNgF/6N40AyzQkR1hV0pvB/289yldvvidMsq01vgAD62dTChip28xeoT6TZPsc65MJVc9VuJHwNENTOAXQHW6O55ZN9ZmOSxLJTmTkKcpBGvgSzvo9metxEUim6E+wgyf4C5XInEBtGHVEU1IpXKtZaySVzlRiHXP/dg43sIavsQ58tUGeCUOkDIxx6eKbyVOITh/kNJ3bbzfiy8t9ZKjkngcPWKJftw/kX31SNxYieKfHpKTM9Ke0DwjIX3U8x31v76x7aLMwqu8s4RXuZroT80w2Nfv2BUQSPc9EsdXO1kuGYi/E7+bTBs0H/qNbXMzTFiAdRHy+XqV1XJii28SK5NNvsA9Biawl2wSlQm9gexhBOeEbpfeSJwPfxzajq2t6xp2l8F2cA9ztrFyOMC8Wd5Bts13X+KvqRl8Kuw4YN5t84zSeHw4FuMfTwYeeMr0aR/jNZe/yX4QHw==)
455459
456-
### Angular Signals
460+
#### Angular Signals
457461
458462
Angular is undergoing some fundamental changes by foregoing dirty-checking and introducing its own implementation of a reactivity primitive. The Angular Signal API looks like this:
459463

0 commit comments

Comments
 (0)