This component directly provides you the Stars rating component with all the options/settings you need.
This module is meant to be used in react projects.
install this module using the following command in your project directory:
npm i -S react-starred@latest
one the module is installed in the project, import the module into the file you want to use with the following command:
import Stars from 'react-starred';
once imported, you can use the Stars component with the following syntax:
<Stars given={3} on={5} updateGiven={yourMethodToUpdateGivenStarsValue} />
The best way to use this component is as follows:
const App = () => {
const [given, updateGiven] = useState(3);
useEffect(() => {
console.log(given); /* you will get the updated given stars count here */
});
return (
<div>
<Stars given={given} on={10} updateGiven={updateGiven} />
</div>
);
};
render(<App />, document.getElementById("app"));
click here to view demo.
- NodeJs - Server Environment
- ReactJS - Web Framework
- FontAwesome - library for fonts icons
- @ovpv - Idea & Initial work