State
Append to array state
Create a new array with a new item rather than mutating the existing array.
Formal Syntax & Structure
react syntaxreact
setItems(old => [...old, item])Working Example
Example Snippetreact
setItems(old => [...old, { id: "tray" }])