Form Actions
Loading "Form Actions"
Run locally for transcripts
π¨βπΌ
onSubmit
handlers that prevent default and handle file uploads like this
are so common that React has a built-in way to do that! The action
prop on a
form can accept a function! The function accepts a formData
object.Note that in HTML, attributes cannot accept functions. The action prop
accepting a function is a React feature.
In this exercise, create a function for logging the
formData
like we are
currently and delete all the superfluous props.π
<form />
React docs