ertanhasani / react-stars

A simple star rating component for your React projects :star:
70 stars 13 forks source link

Add onClick event handler #14

Open jamesl1001 opened 3 years ago

jamesl1001 commented 3 years ago

If a user selects 3/5, then clicks 3/5 again, with only onChange there is no way for the event to be triggered again.

For more context, in my case, I have a model which opens when the user clicks on any star. That modal can then be dismissed. The state of the original stars remains the same. If the user clicks the same star again, nothing happens because the rating is not changing. The modal will only appear again if the user changes their rating.

ertanhasani commented 3 years ago

Ok, i see. I would not make any changes on the onChange function, and instead, we could have a function onClick that you can use it. I'm gonna try to do it as soon as I have some free time. Otherwise, feel free to add it and create PR for it.