Creates a signal whose value may have several, deeply nested signals. Any time any of the nested signals are updated, the signal will be updated as well. The returned value from the signal will be all of the resolved values from the nested signals.
The nest object that contains signals.
Options that effect the behavior of the signal.
const $count = signal(0);const $text = signal('hello');const $why = signal({ count: computed(() => $count() + 1), text: [$text] })const $nested = nestSignal({ count: $count, text: $text, why: $why });console.log($nested()); // [LOG]: { count: 0, text: 'hello', why: { count: 1, text: ['hello'] } }$count.set(1);console.log($nested()); // [LOG]: { count: 1, text: 'hello', why: { count: 2, text: ['hello'] } } Copy
const $count = signal(0);const $text = signal('hello');const $why = signal({ count: computed(() => $count() + 1), text: [$text] })const $nested = nestSignal({ count: $count, text: $text, why: $why });console.log($nested()); // [LOG]: { count: 0, text: 'hello', why: { count: 1, text: ['hello'] } }$count.set(1);console.log($nested()); // [LOG]: { count: 1, text: 'hello', why: { count: 2, text: ['hello'] } }
Optional
Creates a signal whose value may have several, deeply nested signals. Any time any of the nested signals are updated, the signal will be updated as well. The returned value from the signal will be all of the resolved values from the nested signals.
Param: source
The nest object that contains signals.
Param: options
Options that effect the behavior of the signal.
Example