
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
react-star-rating-system
Advanced tools
React Star Rating System Docs
export default function App() {
const [data, setData] = useState({title: '', id: 0});
const [rating, setRating] = useState(0);
const [isCustomSubmit, setIsCustomSubmit] = useState(false);
const customClick = async (clickRating: number) => {
console.log("click", clickRating);
if (clickRating) {
fetch(
// must await the custom click function at the declaration level too
"https://jsonplaceholder.typicode.com/todos/" + clickRating
)
.then((response) =>
response.json().then((r) => {
console.log(r);
setData(r);
setRating(clickRating);
})
)
.then((json) => console.log(json));
return console.log(clickRating);
}
};
const customSubmit = async (rating: number) => {
console.log("submit", rating);
if (rating) {
fetch(
// must await the custom click function at the declaration level too
"https://jsonplaceholder.typicode.com/todos/" + rating
)
.then((response) =>
response.json().then((r) => {
console.log(r);
setData(r);
setRating(rating);
})
)
.then((json) => console.log(json));
return console.log(rating);
}
};
const customHover = async (hoverRating: number) => {
console.log("hover", hoverRating);
if (hoverRating) {
return fetch(
"https://jsonplaceholder.typicode.com/todos/" + hoverRating
).then((response) =>
response.json().then((r) => {
console.log(r);
})
);
}
};
const handleClick = () => {
setIsCustomSubmit(true);
setTimeout(() => {
setIsCustomSubmit(false);
}, 0); // since it's wrapped in a timeout, it sets it to false after the render, giving the prop time to be true until the submit function is completed.
};
return (
<>
<h1>Title: {data?.title as string}</h1>
<p>ID: {data?.id}</p>
<StarRatingSystem
defaultRating={rating}
isCustomSubmit={isCustomSubmit}
customSubmit={customSubmit}
shouldResetWhenNotClicked
shouldResetWhenNotHovered
container={Container}
/>
<br />
<br />
<button onClick={handleClick}>Submit</button>
</>
);
}
const Container = ({children}: any) => {
return <span id="star-container-out">{children}</span>;
};
FAQs
Star rating system written in react.
The npm package react-star-rating-system receives a total of 7 weekly downloads. As such, react-star-rating-system popularity was classified as not popular.
We found that react-star-rating-system demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.