For that we will use another function called addData that will be called on clicking submit button, and we will add input data to our object using spread operator.
Ya it's a task given by my manager, finished it.i used a form with input fields and on submit I got the value by document.getelementbyid and pushed into the state object and rendered it as a seperate row and also added a delete functionality by filter out by the id prop.Btw great article!
For that we will use another function called addData that will be called on clicking submit button, and we will add input data to our object using spread operator.
Ya it's a task given by my manager, finished it.i used a form with input fields and on submit I got the value by document.getelementbyid and pushed into the state object and rendered it as a seperate row and also added a delete functionality by filter out by the id prop.Btw great article!
Why did you use document.getElementById? In react we use e.target.value
Ya its cool,but i had more input fields in the form and I struggled to manage them,can you come up with a solution, [e,target.name]?
Yes