| Level Navigation: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19⚡ | 20 |
Goal: Add a form to your PotluckMeals component for adding new meals.
User Story: As a user, I want to fill out a form to add my dish to the potluck so that others can see what I’m bringing.
Add a form with input fields for meal details to your component.
onSubmit={handleAddMeal} inside your return statement, after the ul elementNeed help with form structure? Check out these snippets:
// Add this inside your return statement, after the ul element
<div>
<form onSubmit={handleAddMeal}>
<label>
Meal: <input type="text" name="mealName" />
</label>
<br/>
<label>
Guest: <input type="text" name="guestName" />
</label>
<br/>
<label>
Serves: <input type="number" name="serves" />
</label>
<br/>
<label>
Kind of Dish: <input type="text" name="kindOfDish" />
</label>
<br/>
<button type="submit">Add Meal</button>
</form>
</div>