Home
Customisable star-rating component
(Used in Movie Watchlist App)
Default props:
The following props can be passed to the component to customise it. Defaults values apply when props omitted:
maxRating=5
defaultRating=0
starColor='#fcc419'
ratingColor='#000'
size=48
className=''
messages=[]
onSetRating
Example 1
Props:
maxRating={3}
starColor='red'
size={32}
messages={['Terrible', 'Okay', 'Excellent']}
Example 2
setState can be passed to onSetRating to be used anywhere outside the component:
Props:
maxRating={10}
size={24}
starColor='blue'
ratingColor='blue'
onSetRating={setMovieRating}
(Outside of component:)
This movie was rated 0