In my continued learnings on using React, I decided to follow a tutorial on how to make a job list. I am at the point where I know I need to lay off tutorials but, as a novice in React and programming in general, I find myself to be overwhelmed and intimidated when trying to do things on my own. So, when I decide to google "how to start" I end up following the full tutorial.
Anywho! This job list comes complete with a submit and delete button to edit the list of names. It uses the state of the App component, which is just an empty characters array object, to save the input data.
The way to input and save this data comes from the handleSubmit method created in the parent App component. What this method does is add a character to the list of characters once the submit button has been clicked. That gets passed into the Form component as a prop.
Now, in the render method of the Form component, a submit button is added with an onClick prop that calls back to the submitForm method created in the same file that calls back to the _handleSubmit method and passes the Form state through as the character parameter. Afterward, it is reset to its initial state to clear the form after submit.
Top comments (0)