4.11 form submission processing

Now we could add an earpiece click here to his expenses button but that won’t be the best way to listen here because there is indeed a behaviour default built-in browser and form on the web pages it is on this form I want to react during submission and then perform a function whenever this form and submitted from the moment in shape we add onSubmit like this now it’s a functional announcement here and I would call it submitHandler and then if we just focus on submitHandler as we did for all events also inside you mark submitHandler we’ll add in event and between the crocher we’ll put event point presale default

this object was definitely added a method of prevention prevention default always inside just to explain what the methods are preventDefault it is linked to the Event interface, indicates to the user agent only if the event is not explicitly managed, the default action should not be executed as it is normally. of const we will add a new const dépenses Data and we but the brackets say that the object expenditure data here and now combined to all data entered of course if you use this approach has a state instead of being free you already have such an object who’s here but I don’t have him here

I’ll send you now to create once the submitted form and simply add a title here and set this to the value stored in the title seized a property of my time inside of spendingData on va ajouter title enteredTitle vous put a comma under it we’ll add Amount here we’ll add enteredAmount and here on the other hand we will add a new dates new dates in brackets we’ll put enteredDate now we have his property names here and here depends on you because it is your object now just between the two crochers we will add a console.log in parentheses expense data excuse me it’s expense data like this. and if you go to your website and you test features should be added normally in your address display we meet for the next course