spread syntax

The three-dot JavaScript syntax that copies the items of an array or the properties of an object into a new one.

In more detail

[...list, item] creates a new array with one more item, and { ...obj, name } creates a new object with one field changed. The copy is shallow, so nested objects are still shared.

Examples

React state updates rely on it to create new values instead of changing the old ones.
setItems((prev) => [...prev, newItem])

Related terms

Taught in

References