Basic React component for star (or any other icon based) rating elements
Basic React component for star (or any other icon based) rating elements
Tiny React.js component for star (or any other icon based) ratings.
npm install react-star-rating-component --saveimport React from 'react';
import ReactDOM from 'react-dom';
import StarRatingComponent from 'react-star-rating-component';
class App extends React.Component {
constructor() {
super();
this.state = {
rating: 1
};
}
onStarClick(nextValue, prevValue, name) {
this.setState({rating: nextValue});
}
render() {
const { rating } = this.state;
return (
);
}
}
ReactDOM.render(
,
document.getElementById('app')
);import React from 'react';
import ReactDOM from 'react-dom';
import StarRatingComponent from 'react-star-rating-component';
class App extends React.Component {
render() {
const { rating } = this.state;
return (
);
}
}
ReactDOM.render(
,
document.getElementById('app')
);Check more in examples folder.
MIT Licensed
No open issues yet, or sync has not completed.