Welcome to the Star Ratings App! This is a simple React application that generates star ratings based on the number of stars given. The app uses a function to create a string of filled and empty stars representing the rating with proper intuition of Problem in the code as well as in this Readme.
As we used 5 filled and 5 empty stars and used slice method here. Suppose I entered '1', then in slice method, 5 - stars meaning (5 - 1) becomes 4 so it will start from 4th star that is filled and 10 - stars meaning (10 - 1) becomes 9 so iterates from 4,5,6,7,8,9 where 5 to 9 are empty stars displaying 4 empty stars and one filled star.
To run the app locally, follow these steps:
-
Clone or Download the Repository:
- Click the "Code" button above to clone or download the repository.
- If you choose to clone, use your preferred Git tool to clone the repository to your local machine.
- If you choose to download, extract the downloaded ZIP file to your desired location.
-
Navigate to the Project Directory: Open your terminal/command prompt and navigate to the project folder.
-
Install Dependencies: Install the required dependencies using npm:
npm install
-
Start the Development Server: Start the development server to run the app:
npm start
The app will be accessible at http://localhost:3000 in your web browser.
This project includes a simple React component that demonstrates the concept of star ratings. The main component, App.js
, contains a function that generates star ratings based on a provided number of stars. The app then displays example ratings using this function.
The aim of this project is to provide a clear and simple example of how to generate and display star ratings using React. It's a foundational example that can be expanded upon to include more advanced features or integrated into larger applications.
Feel free to explore and modify the code to suit your needs!
Created with π by Saad