Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // FONCTION
- handleIngredientNameChange = (idx) => (event) => {
- const newIngredient = this.state.ingredients.map((ingredient, sidx) => {
- if (idx !== sidx) return ingredient;
- return { ...ingredient, name: event.target.value };
- });
- this.setState({ ingredients: newIngredient });
- }
- // AJOUT DE CHAMPS
- handleAddIngredient = () => {
- this.setState({ ingredients: this.state.ingredients.concat([{ name: '' }]) });
- }
Add Comment
Please, Sign In to add comment