Menu Close

rolling-dice

React App Rolling the dice

The DiceRoller component is a flexible and reusable React component that can be configured with the props and callback function.

To implement DiceRoller component in your application, you can follow these steps:

  1. Install the Prop Types package to ensure that the parent component passes the required props to the DiceRoller component.
  2. Import the DiceRoller component into your application.
  3. In the parent component, pass the desired number of dices and rolls to the DiceRoller component through props.
  4. Use a callback function from the parent component to the DiceRoller component, which can be used to pass data from the DiceRoller component to the parent.
  5. The DiceRoller component will automatically generate random numbers based on the specified number of dices and rolls, and display them in the TableScore child component.

Also used React Hooks such as useState, useEffect and useCallback to manage the state and lifecycle of the component.

Tux, the Linux mascot

Getting Started

Installation

To install all dependencies run the following commands.

npm install

RUN

To run this application use the following commands.

npm run start
View Source Code
Posted in Development