n49 / react-stars

A simple star rating component for your React projects :star:
http://developers.n49.com/react-stars/
218 stars 81 forks source link

half and edit props are always either the default value or false #5

Open varemenos opened 7 years ago

varemenos commented 7 years ago

https://github.com/n49/react-stars/blob/master/src/react-stars.js#L40-L50

    if(typeof props.half === 'undefined') {
      props.half = true
    } else {
      props.half = false
    }

You are checking whether the prop is not passed and then set it to true, I guess that's the default value and it makes sense. But in the other case where the code enters the else clause (a value is passed to the prop and that overrides it's default value) you explicitly set it to false :question:

The else clauses seem redundant and are the culprits causing the issue, don't you think?

waymondo commented 7 years ago

I ran into this today as well. Seems odd you can't pass in values of true and false for these props.