Using what you have just learned about
state in React, you are going to create a
<DiceBox /> component that renders 5 dice numbers for the user to view.
- Create a class component called
- Write a method in that class that produces 5 random numbers between 1 and 6 and saves them in state.
- Display the 5 random numbers in your
- Provide a button the user can click on that will redo step 2 and present the new numbers to the user.
Take it further
- Create a
<Die />component that receives a random number as a
propand displays it (rather than just displaying the 5 numbers in the
- Allow the user to click on a given
<Die />to select it, and that number will not change until the dice reset.
- Have the dice reset (de-selecting all previously selected die) after every 3rd roll.