Grokking React Advanced
0% completed
Handling Form Submission and Form Actions
The same sign-up form can be written in two ways. In the first, the component keeps four pieces of state, handles the onSubmit event, calls preventDefault, and switches a loading flag on and off. In the second, the component passes one function to the form's action prop, and React does the rest of that work. This lesson builds the first version, because most existing code uses it, and then rewrites it in the second.
The event handler version
React Fundamentals taught controlled inputs: each input's value lives in state, and an onChange handler updates it
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%