Grokking React Advanced
0% completed
Understanding FormData in React
function handleSubmit(event) { event.preventDefault(); const formData = new FormData(event.currentTarget); console.log(formData.get('name'), formData.getAll('topics')); }
Jane Doe [ 'react', 'css' ]
Those three lines read a whole form without a single piece of React state. The form had a name field and two ticked checkboxes, and new FormData(form) collected their values in one step. This chapter is about forms in React, from reading their values to showing a result before the server answers, and `FormData
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%