๐ Welcome to the Dice Rolling project! ๐ This exciting ๐ฅณ and interactive ๐ฎ application rolls two dice ๐ฒ๐ฒ to display random numbers between 1๏ธโฃ and 6๏ธโฃ. Every time you click the button ๐ฑ๏ธ, the dice shake ๐ and show a new random number ๐ฐ on their upper faces, just like standard dice ๐ฒ.
The Dice Rolling App ๐น๏ธ is a fun and engaging ๐ web application that brings the classic dice rolling experience ๐ฒ to your screen. The app utilizes ReactJS โ๏ธ for seamless functionality and CSS ๐จ for smooth animations. Each time you roll, the dice display a random number ๐ with standard dot patterns using the Font Awesome library ๐จ. Whether youโre playing a game ๐ฒ๐ฏ or just having fun ๐น๏ธ, this app will keep you entertained! ๐
- ReactJS โ๏ธ: The core library for building interactive UIs ๐ป.
- CSS ๐จ: For stunning visual effects ๐ and animations โจ.
- Font Awesome ๐จ: To display dice dots accurately โชโชโช.
- Clone the repository:
git clone https://github.com/nidhiupman568/DiceRoll-Using-React.JS.git
๐ฅ๏ธ. - Navigate to the project directory:
cd dice-rolling-app
๐. - Install the necessary dependencies:
npm install
๐ฆ. - Start the application:
npm start
๐. - Open your browser ๐ and go to:
http://localhost:3000
to see the app in action! ๐ฒ๐
The project structure ๐๏ธ is organized into components ๐งฉ:
- Die ๐ฒ: A stateless component that shows a single die with the correct dotted number.
- RollDice ๐ฒ๐ฒ: Contains the logic ๐ก to generate random numbers and handle button clicks ๐ฑ๏ธ. This component renders two Die components side by side ๐ซ.
/dice-roll-app
โ
โโโ /public
โ
โโโ /src
โ โโโ /components
โ โ โโโ Die.js ๐ฅ๏ธ
โ โ โโโ Die.css ๐จ
โ โ โโโ RollDice.js ๐ฅ๏ธ
โ โ โโโ RollDice.css ๐จ
โ โ
โ โโโ App.js ๐ฅ๏ธ
โ โโโ index.js ๐ฅ๏ธ
โ
โโโ package.json ๐ฆ
โโโ README.md ๐
Here are the key dependencies used ๐:
- React:
^18.2.0
โ๏ธ - React-DOM:
^18.2.0
๐ฅ๏ธ - FontAwesome:
^6.4.0
๐จ for icons ๐ผ๏ธ.
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.4.0",
"@fortawesome/free-solid-svg-icons": "^6.4.0",
"@fortawesome/react-fontawesome": "^0.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1"
}
Here's how the Dice Rolling App ๐ฒ looks in action! ๐ท:
- Create the application using the following command:
npx create-react-app dice-roll
๐ ๏ธ. - Navigate to the project folder:
cd dice-roll
๐. - Install the required modules ๐ฆ:
npm i @fortawesome/fontawesome-svg-core npm i @fortawesome/free-solid-svg-icons npm i @fortawesome/react-fontawesome
- Create a new directory called components ๐ and add the necessary files:
RollDice.js
,Die.js
,RollDice.css
, andDie.css
๐. - Run the application using the following command:
npm start
๐. - Open your web browser and go to
http://localhost:3000
๐ to view the Dice Rolling App in action! ๐
Thank you for checking out the Dice Rolling App ๐ฒ! Feel free to share your feedback ๐ฌ or contribute to the project by making a pull request ๐. Happy coding! ๐ป๐
Feel free to fork ๐ด this repository and make pull requests ๐. For any issues ๐ ๏ธ or suggestions ๐ก, please open an issue ๐.
This project was bootstrapped with Create React App.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes.
You may also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
Note: this is a one-way operation. Once you eject
, you can't go back!
If you aren't satisfied with the build tool and configuration choices, you can eject
at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject
will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use eject
. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify