Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed React by Example!
You have completed React by Example!
Preview
It's time to let users add names to the list! We're going to use the form to collect guest names. When the form submits we'll add that name to the app's state.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
So we're going to use the form at the top
of the app to collect guest names.
0:00
When the form submits,
we'll add that name to the app state.
0:02
And just as we've seen the other inputs so
far,
0:06
we'll use the app state
to hold the form state.
0:08
And we'll create handlers to allow users
to type names into the form field,
0:11
as well as submit the form and
add those names to the state.
0:16
So let's get started.
0:20
I'll start by adding a property on
the state to track the form input data.
0:21
I'll name the property pendingGuest and
set it to an empty string.
0:26
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up