Creates a reactive store from an initial state object or array. Stores provide a way to work with nested reactive data structures more conveniently than using multiple individual signals.
Type:
Parameters:
state
: The initial state object/array or an existing storeReturns: An array containing the reactive store object and a setter function
Store<T>
: The reactive store object with getters for each propertySetStoreFunction<T>
: A function that updates the store, accepting either a new partial state object (merged with existing state) or a function that takes the current state and returns a new partial state. Properties set to undefined
will be removed from the storeExample: