REACT Adding a new item to state

REACT Adding a new item to state
0

#1

Adding a recipe works but it doesn’t stay in state. It get’s removed/replaced immediately.

I’ll be honest. I haven’t got a clue what is going on.

saveNewRecipe happens on line 62.


#2

The saveNewRecipe function executes when the form is submitted. To prevent the form from actually submitting and refreshing the page you need to accept the event into the function and then then prevent the form from submitting. If you do that you can then go back and see the recipe you have submitted

saveNewRecipe(evt) {
    evt.preventDefault();
    console.log("adding new recipe", this.refs.recipeName.value);
    ....

#3

Ok, I forgot about that “feature”.
I can work with that.