1.4.4 • Published 5 years ago

react-starred v1.4.4

Weekly downloads
37
License
-
Repository
github
Last release
5 years ago

📝 Table of Contents

🧐 About

This component directly provides you the Stars rating component with all the options/settings you need.

Prerequisites

This module is meant to be used in react projects.

Installing

install this module using the following command in your project directory:

npm i -S react-starred@latest

🎈 Usage

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"));

Demo

click here to view demo.

⛏️ Built Using

✍️ Authors

  • @ovpv - Idea & Initial work