This is a sample React project, built around a StarRating component which displays stars and half-stars based on the inputs you give it, similar to what you might see on Amazon or other ecommerce websites.
git clone https://github.com/Jantho1990/react-star-rating.git react-star-rating
cd react-star-rating
npm install
npm start
This should open a page on your browser to the demo app. If not, you should be able to access it via localhost:3000
.
Change the inputs via the inputs section:
Rating
changes the actual rating.Min Rating
sets the lower limit for a rating.Max Rating
sets the upper limit for a rating.Star Ratio
sets how many rating points are required to add a star.
Updating the input values should show in the field of stars below the React logo. Visually, increments only occur in half-stars, but you can set the rating to anything you want.
This is just a sample project. It was not designed for inclusion in a real app. That said, if it inspires you, that's awesome!