-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to clear rating #31
Comments
awran5
added a commit
that referenced
this issue
Oct 28, 2022
Hi @sspenst Sorry for the late response. Please first update to v5.1.5 And follow this example: function MyComponent() {
const [rating, setRating] = useState(0)
const handleRating = (rate: number) => {
setRating(rate)
}
const handleReset = () => {
// Set the initial value
setRating(0)
}
return (
<div className='App'>
{/* set initial value */}
<Rating onClick={handleRating} initialValue={rating} />
<button onClick={handleReset}>reset</button>
</div>
)
} |
Thanks @awran5 ! I've added a reset button and it seems to work fine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can I clear the rating back to the initial empty state? Previously I could use
ratingValue
to clear when clicking the current rating:But with the removal of
ratingValue
in v4.1.0 I'm no longer sure how to do this.Please let me know if there is another way to clear the rating on the latest version!
The text was updated successfully, but these errors were encountered: