This is a super-simple star rating component.
Run npm install
in the project directory. Then, run npm start
to boot up
the demo locally using webpack on localhost:8080
Enjoy!
<Rating
average={3.2}
icon={StarIcon}
max={MAX}
onChangeRating={rating => console.log(`Rating ${rating}/${MAX} selected.`)}
/>
Displays and indication to the user what the average rating for the associated item is.
The icon to use for the rating. Stars are a common choice!
The maxmium value of the rating that the user can select.
Callback fired each time the rating is changed by the user.
- Better mobile support.
- See if
shouldComponentUpdate
can be utilised to prevent unecessary rerenders. - Is SVG the best choice for file size? (Especially if doing server side rendering)
- More enzyme tests around the
mouseenter
andmouseleave
events. - Generate proptypes from flow types for consumers who aren't using flow.