Skip to content

Latest commit

 

History

History
73 lines (49 loc) · 1.71 KB

readme.md

File metadata and controls

73 lines (49 loc) · 1.71 KB

React Starred


📝 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