DEV Community

Discussion on: An easy way to create a customize dynamic table in react js

Collapse
 
abdulbasit313 profile image
Abdul Basit

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.

Collapse
 
aashiqincode profile image
Aashiq Ahmed M

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!

Thread Thread
 
abdulbasit313 profile image
Abdul Basit

Why did you use document.getElementById? In react we use e.target.value

Thread Thread
 
aashiqincode profile image
Aashiq Ahmed M

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]?

Thread Thread
 
abdulbasit313 profile image
Abdul Basit

Yes