Spread and Rest (...)
Use the ... operator to copy and combine arrays and objects without mutating them — the exact technique React state updates rely on — and to collect extra arguments.
Spread: unpack an array into a new one
The spread operator — three dots ... — takes the items inside an array and "spreads" them into a new array. It's the modern way to copy and combine arrays without touching the originals.
const fruits = ["apple", "mango"];
const more = [...fruits, "lime"]; // a NEW array: apple, mango, limeThis matters enormously in React. When you update state, you must create a new array rather than changing the old one — and spread is how you do it. Adding a todo is [...todos, newTodo]; the original todos stays untouched.
[...fruits, "lime"] creates a brand-new array. The original fruits is unchanged. This "make a new copy instead of editing in place" habit is the foundation of how React (and tools like Redux) track changes.