diff --git a/src/routes/(0)concepts/(2)signals.mdx b/src/routes/(0)concepts/(2)signals.mdx index 0eca596768..6e79f13e41 100644 --- a/src/routes/(0)concepts/(2)signals.mdx +++ b/src/routes/(0)concepts/(2)signals.mdx @@ -72,6 +72,17 @@ setCount((prevCount) => prevCount + 1); console.log(count()); // output: 1 ``` +When a signal contains an object or array, mutating it directly does not notify subscribers because the setter was not called. +Use the setter to create a new object or array instead: + +```jsx +const [items, setItems] = createSignal(["apple", "banana"]); + +setItems((currentItems) => [...currentItems, "cherry"]); +``` + +For state that requires frequent nested updates, consider using a [store](/concepts/stores) instead. + ## Reactivity Signals are reactive, which means that they automatically update when their value changes.