star-based-rating
v1.5.7
Published
injecting star-based rating in React Applications
Downloads
21
Maintainers
Readme
star-based-rating
Install
npm install star-based-rating --save
Demo
Props
I have kept minimal configurations. Less configurations Less confusions. You can edit them as well. Also you can show previous stars
<StarBasedRating
onSelectRatingStars={this.selectStarHandler.bind(this)}
totalStars={10}
previousStarsToDisplay={3} />
// onSelectRatingStars: Method that you want to run after selecting
// totalStars: Total Number of stars you want to display
// previousStarsToDisplay: Provide existing stars already
How simple is this !! :blush:
Example
import React from 'react';
import ReactDOM from 'react-dom';
import StarBasedRating from 'star-based-rating'
class App extends React.Component {
selectStarHandler(totalStarsSelected) {
/* totalStarsSelected param is giving you
selected number of stars and what you want to do with it */
}
render() {
return (
<div>
<StarBasedRating
onSelectRatingStars={this.selectStarHandler.bind(this)}
totalStars={10}
previousStarsToDisplay={3} />
</div>
)
}
}
ReactDOM.render(
<App />,
document.getElementById('app')
);
MIT Licensed
:smiley: