const [items, setItems] = useState([]); function addItem(newItem) { setItems(prevItems => [...prevItems, newItem]); }