react-rating
react-rating copied to clipboard
Don't show initialRating on props suggestion and show Value prop instead
On 1.3.2 version Why don't show "initialRating" prop on props suggestion and what is the "value" prop on props suggestion shows instead?
Hey @sayedsaeedhosseini!
I am a bit lost... What do you mean? What is props suggestion? Do you mean to change initialRating prop name to value?
+1
@dreyescat
I think @sayedsaeedhosseini means exactly what you said - value would be a better name, since it's not only "initial" rating that is specified by this property, but a rather a value wich changes during user interaction, so it's not "initial" any more but rather "updated" or "changed", so just value would be better.
Hey @sayedsaeedhosseini!
I am a bit lost... What do you mean? What is props suggestion? Do you mean to change
initialRatingprop name tovalue?
@dreyescat Thanks for your comment. I work with Webstorm and when I import and use your component on my code, I get prop suggestion (It show me your component's props as a suggestion to use them) but dont suggest me "initialRating" prop and show me "value" as a prop and it doesnt work when I use it.
Is it a bug or It`s my suggestion extension wrong?
@aepp
Well... Yes and no.
No because technically the initialRating prop is used to initialize the value state during the initial rendering. Once the rating element is rendered the value can be changed clicking on any symbol independently of what the initial value was. You can see this as the react defaultValue. But I prefer initial instead of default 😉. Let's say this is a sort of uncontrolled component.
Yes, because when you use it as a controlled component (i.e., when you take over the value state) initialValue prop and value state become the same. You are constantly overwriting the value state with the intialValue.
This is why I think initialValue is better than value. Buy I understand it is just a matter of semantic 😃 .
@sayedsaeedhosseini
I don't use and have never used Webstorm so far. I know that we use an internal component (not the public layer) that has a value prop. Maybe the extension is mixing this internal component properties with the public component ones showing you the union of both component properties. Then, if you select the value prop it is just ignored because the public component does not have this property. Just guessing... 😅