![Logo](/_astro/logo.DNC1PCTe_Z1abT04.webp)
Enter a search term above to see results...
Enter a search term above to see results...
A very common pattern when dealing with signals is to modify an existing signal value then update its underlying value triggering reactivity.
This can create a lot of boilerplate because you will need to access the value nonreactively and then update the underlying value before finally setting the value again.
const numbers = signal([1, 2, 3]);const newNumbers = numbers.peek();newNumbers.push(4);numbers.set(newNumbers);
Helpers handle updating an underlying reactive value without having to retrieve and manipulate the value.
const numbers = signal([1, 2, 3]);numbers.push(4);
Helpers are provided for various types of signal primitives that help with the most common ways they are used.
Array helpers make it easy to update array values with push
, unshift
and non-standard helpers like removeIndex
, setIndex
and others.
Collection helpers make it easy to update specific values in an array of records by their ID. id
will match against _id
, id
, hash
, key
fields on any object in the array
Boolean helpers like toggle
make it easier to toggle boolean values.
API Reference - You can learn more about individual mutation helpers in the API reference guide for reactivity.