const App = () => { const [parties, setParties] = React.useState([ { id: 1, title: "Beach Bonanza", date: "2023-07-15", location: "Santa Monica Beach", host: "Alex Johnson", attendees: 12, items: ["Cooler", "Beach Towels", "Snacks", "Sunscreen"] }, { id: 2, title: "Housewarming Party", date: "2023-08-02", location: "123 Main St", host: "Jamie Smith", attendees: 25, items: ["Appetizers", "Drinks", "Dessert", "Games"] } ]); const [activeTab, setActiveTab] = React.useState('create'); const createNewParty = (e) => { e.preventDefault(); const form = e.target; const newParty = { id: parties.length + 1, title: form.title.value, date: form.date.value, location: form.location.value, host: "You", attendees: 0, items: form.items.value.split(',').map(item => item.trim()) }; setParties([...parties, newParty]); form.reset(); setActiveTab('view'); }; return (
Plan your perfect party and coordinate with friends!
{new Date(party.date).toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}
{party.location}
Hosted by {party.host}