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 Components!
You have completed React Components!
Preview
Now it's time to let users add players to the Scoreboard! First, we'll create an event handler that allows users to submit the form. Then we'll write a function that adds the new player to state and displays it in the UI.
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
We're going to use the Add Player
form to submit player names.
0:00
When the form submits, we'll add
the name along with initial score and
0:00
player ID to the player state.
0:04
First, we're gonna create an event handler
to allow users to submit the form and
0:09
then a function that will add a new player
to state and display it on the board.
0:14
Let's get to it.
0:19
Currently AddPlayerForm has no
access to the player state that's
0:23
maintained in the App component.
0:27
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