Do you want to build a Snowman?
In this assignment, you'll build a less grim variation of a popular game:
- Reinforce component architecture in React
- Effective use props and state in React
We're going to build a sort of reverse hangman. The player can't lose; they just get to build a snowman by adding parts each time they guess a letter correctly. You will need to download these files and add them to your project:
degit $GITHUB_USER/react-project-template Snowman
- Selects a random word from the list and display a number of blank spaces (or underscores) equal to the word length.
- Display a list of letters, A through Z as clickable buttons.
- When the player guesses a letter (clicks the button):
- All instances of that letter are revealed at their corresponding positions in the word.
- The button becomes disabled, as it has already been guessed.
- Display the snowman image that corresponds with the number of letters revealed in the word.
- After the word has been completed, offer the player to play again. Reset the state of the game without a page reload.
- Use this API to get your random word
Refactor the game to play like a traditional "hangman" game:
- If the chosen letter is not part of the word, the snowman "grows"; increase a counter by one for each incorrect guess.
- If the snowman is completed (counter reaches 7) before the word is completed, the player loses, and the snowman wins.