Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Complete the final challenge using the `useContext`, `useState` and `useHistory` hooks.
Switch Statement
switch (event.target.name) {
case "name":
setName(value);
break;
case "username":
setUser(value);
break;
case "password":
setPass(value);
break;
default:
return;
}
Treehouse Course on switch
statements
if else
if (event.target.name === 'name') {
setName(value);
}
else if (event.target.name === 'userName') {
setUser(value);
}
else if (event.target.name === 'name') {
setPass(value);
}
else {
return;
}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Nick Huemmer
Front End Web Development Techdegree Graduate 26,840 Points1 Answer
-
Matthew Turner
Full Stack JavaScript Techdegree Graduate 16,968 Points2 Answers
-
Joseph Lander
Full Stack JavaScript Techdegree Graduate 27,765 Points1 Answer
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
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